Skip to content

Commit

Permalink
attempt build arguments in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ofersadan85 committed Jul 29, 2023
1 parent fbc690e commit a19769c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This workflow should control anything to do with web frontend
# Including building the docker image and pushing it
# It should run on both development and production scenarios
# Production workflow (tagging the image as "latest") should run only on tagged version push

name: Web workflow

on:
Expand Down Expand Up @@ -48,13 +43,27 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
- name: Build and push (tagged releases)
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v4
with:
context: src/web
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
SERVER_BASE_URL=https://encyclo-flower.com/api/v1
- name: Build and push (other triggers)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: docker/build-push-action@v4
with:
context: src/web
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
SERVER_BASE_URL=https://dev.encyclo-flower.com/api/v1
deploy:
if: ${{ github.event_name != 'pull_request' }}
Expand Down
4 changes: 0 additions & 4 deletions server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ services:
restart: always
env_file:
- PRODUCTION.env
environment:
- SERVER_BASE_URL=https://encyclo-flower.com/api/v1
networks:
- production

Expand All @@ -60,8 +58,6 @@ services:
restart: always
env_file:
- DEVELOPMENT.env
environment:
- SERVER_BASE_URL=https://dev.encyclo-flower.com/api/v1
networks:
- production

Expand Down
3 changes: 2 additions & 1 deletion src/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Build stage
FROM node:20-alpine3.18 as builder

ARG SERVER_BASE_URL=https://dev.encyclo-flower.com/api/v1
WORKDIR /app
COPY package*.json .
RUN npm ci
Expand All @@ -12,7 +13,7 @@ FROM node:20-alpine3.18 as production

WORKDIR /app
COPY package*.json .
RUN npm ci --only=production
RUN npm ci --omit=dev
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public

Expand Down

0 comments on commit a19769c

Please sign in to comment.