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 7206aae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 9 additions & 5 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,10 +43,19 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set SERVER_BASE_URL (tagged releases)
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SERVER_BASE_URL=https://encyclo-flower.com/api/v1" >> $GITHUB_ENV

- name: Set SERVER_BASE_URL (other triggers)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "SERVER_BASE_URL=https://dev.encyclo-flower.com/api/v1" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v4
with:
context: src/web
build-args: SERVER_BASE_URL=${{ env.SERVER_BASE_URL }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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
2 changes: 1 addition & 1 deletion src/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 7206aae

Please sign in to comment.