Skip to content

Commit

Permalink
Add frontend Dockerfile (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon authored Apr 30, 2023
1 parent 6b1f2bc commit 7b53f89
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build Docker image
- name: Build backend Docker image
run: sudo docker build .
working-directory: backend

- name: Build frontend Docker image
run: sudo docker build .
working-directory: frontend
30 changes: 23 additions & 7 deletions .github/workflows/publish_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME_FRONTEND: ${{ github.repository }}-frontend
IMAGE_NAME_BACKEND: ${{ github.repository }}-backend

jobs:
build-and-push-image:
Expand All @@ -28,17 +29,32 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
- name: Extract metadata (tags, labels) for frontend Docker image
id: meta_frontend
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND }}

- name: Build and push Docker image
- name: Extract metadata (tags, labels) for backend Docker image
id: meta_backend
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}

- name: Build and push frontend Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: frontend
push: true
file: frontend/Dockerfile
tags: ${{ steps.meta_frontend.outputs.tags }}
labels: ${{ steps.meta_frontend.outputs.labels }}

- name: Build and push backend Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: backend
push: true
file: backend/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta_backend.outputs.tags }}
labels: ${{ steps.meta_backend.outputs.labels }}
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY . /app
WORKDIR /app

# -- Install dependencies:
RUN addgroup -S bracket && adduser -S bracket -G bracket \
RUN addgroup --system bracket && adduser --system bracket --ingroup bracket \
&& chown -R bracket:bracket /app
USER bracket

Expand Down
11 changes: 11 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM yarnpkg/node-yarn

COPY . /app
WORKDIR /app

# -- Install dependencies:
RUN addgroup --system bracket && adduser --system bracket --ingroup bracket \
&& chown -R bracket:bracket /app
USER bracket

RUN yarn run

1 comment on commit 7b53f89

@vercel
Copy link

@vercel vercel bot commented on 7b53f89 Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.