Skip to content

Commit

Permalink
add docker image + workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinfuchs committed Aug 7, 2022
1 parent 72d8269 commit 4751347
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
**/target
36 changes: 36 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker image

on:
release:
types: [created]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: merlintor/embed-generator:latest,merlintor/embed-generator:${{ github.ref_name }}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:slim
WORKDIR /root/
COPY . .

# Build frontend
RUN cd frontend && npm install --legacy-peer-deps && npm run build && cd ..

# Build backend
RUN apt-get update
RUN apt-get install -y build-essential curl
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH
RUN cd backend && cargo build --release && cd ..

FROM debian:bullseye-slim
WORKDIR /root/
COPY --from=0 /root/backend/target/release/embed-generator ./
EXPOSE 8080
CMD ["./embed-generator"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ npm install
yarn install

# Start the development server (optional)
npm run start
npm run start --legacy-peer-deps
# or
yarn start

Expand Down

0 comments on commit 4751347

Please sign in to comment.