Skip to content

Commit

Permalink
fix: build nginx image for static files
Browse files Browse the repository at this point in the history
  • Loading branch information
olemathias committed Sep 12, 2024
1 parent d60c724 commit 8555956
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image for amd64
- name: Build backend image for amd64
uses: docker/build-push-action@v6
with:
context: .
Expand All @@ -35,4 +35,16 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build nginx image for amd64
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
build-args: |
APP_ENV=nginx-production
push: true
tags: |
ghcr.io/${{ github.repository }}:latest-nginx
cache-from: type=gha
cache-to: type=gha,mode=max
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ RUN echo "Building production image"
ENV DJANGO_SETTINGS_MODULE=tgno.settings.production
RUN python manage.py collectstatic --noinput --clear
ENTRYPOINT ["/app/entrypoint.prod.sh"]
CMD ["gunicorn", "tgno.wsgi:application"]
CMD ["gunicorn", "tgno.wsgi:application"]

# Building the nginx production image
FROM nginx:1.27-alpine AS nginx-production-image
RUN echo "Building nginx-production image"
RUN rm /usr/share/nginx/html/index.html
COPY --from=production-image /app/static /usr/share/nginx/html

# Building the Dev image
FROM base AS dev-image
Expand Down

0 comments on commit 8555956

Please sign in to comment.