Skip to content

Commit

Permalink
Update Dockerfile and inject env vars (#86)
Browse files Browse the repository at this point in the history
* Update Dockerfile and inject env vars

* chore: renamed env vars

* chore: added preprod endpoint as env vars

* chore: substitution

* chore: env and args

* chore: run env

* chore: build-args

* chore: removed /

---------

Co-authored-by: Igor Velickovic <igor.velickovic@gmail.com>
  • Loading branch information
nemo83 and kickloop committed Aug 28, 2023
1 parent ac1eb2e commit d0e5f9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,16 @@ jobs:
- name: Build and Push docker image
uses: docker/build-push-action@v4
env:
ARTIFACT_VERSION: ${{needs.build-version.outputs.ARTIFACT_VERSION}}
REACT_APP_VOTING_APP_SERVER_URL: https://api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org
REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL: https://follower-api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org
REACT_APP_VOTING_VERIFICATION_APP_SERVER_URL: https://verification-api.dev.cf-cip1694-preprod.eu-west-1.metadata.dev.cf-deployments.org
ARTIFACT_VERSION: ${{needs.build-version.outputs.ARTIFACT_VERSION}}-preprod
with:
context: ui/cip-1694
push: true
build-args: |
"REACT_APP_VOTING_APP_SERVER_URL=${{ env.REACT_APP_VOTING_APP_SERVER_URL }}"
"REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL=${{ env.REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL }}"
"REACT_APP_VOTING_VERIFICATION_APP_SERVER_URL=${{ env.REACT_APP_VOTING_VERIFICATION_APP_SERVER_URL }}"
tags: |
${{ env.PRIVATE_DOCKER_REGISTRY_URL }}/${{ env.APP_NAME }}:${{ env.ARTIFACT_VERSION }}
18 changes: 16 additions & 2 deletions ui/cip-1694/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
FROM node:18-alpine AS builder
ENV NODE_ENV production

ARG REACT_APP_VOTING_APP_SERVER_URL=http://localhost:3000
ARG REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL=http://localhost:3000
ARG REACT_APP_VOTING_VERIFICATION_APP_SERVER_URL=http://localhost:3000

ENV NODE_ENV="production" \
REACT_APP_VOTING_APP_SERVER_URL=${REACT_APP_VOTING_APP_SERVER_URL} \
REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL=${REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL} \
REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL=${REACT_APP_VOTING_LEDGER_FOLLOWER_APP_SERVER_URL} \
REACT_APP_TARGET_NETWORK="PREPROD" \
REACT_APP_EVENT_ID="CIP-1694_Pre_Ratification_4619" \
REACT_APP_CATEGORY_ID="CIP-1694_Pre_Ratification_4619" \
REACT_APP_SUPPORTED_WALLETS="flint,eternl,nami,typhon,yoroi,nufi,gerowallet,lace"

RUN env

# Add a work directory
WORKDIR /app
Expand All @@ -13,7 +27,7 @@ RUN npm run react-inject-env && npm run build

# Bundle static assets with nginx
FROM nginx:1.25.2-alpine as production
ENV NODE_ENV production
ENV NODE_ENV="production"
# Copy built assets from builder
COPY --from=builder /app/build /usr/share/nginx/html
# Add your nginx.conf
Expand Down

0 comments on commit d0e5f9f

Please sign in to comment.