Skip to content

Commit

Permalink
fix: inject api-endpoint during buildtime
Browse files Browse the repository at this point in the history
  • Loading branch information
aeweda committed Apr 25, 2024
1 parent d67e8b5 commit 41c744e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ jobs:
sed -i "s#<PRODUCTION_API_ENDPOINT>#$API_ENDPOINT#g" ./ansible/docker-compose.yml
sed -i "s#<STAGING_API_ENDPOINT>#$STAGING_API_ENDPOINT#g" ./ansible/docker-compose.yml
- name: Pull & Rename Images
- name: Pull & Rebuild Images
env:
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
run: |
docker pull witnet/data-feed-app-ui:latest
docker pull witnet/data-feed-app-api:latest
docker tag witnet/data-feed-app-ui:latest witnet/data-feed-app-ui:${{github.ref_name}}
docker build --build-arg API_ENDPOINT=${{ secrets.API_ENDPOINT }} -t witnet/data-feed-app-ui:${{github.ref_name}} -f ./ansible/docker/ui.dockerfile ./packages/ui
docker tag witnet/data-feed-app-api:latest witnet/data-feed-app-api:${{github.ref_name}}
- name: Publish Containers
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ jobs:
sed -i "s#<STAGING_API_ENDPOINT>#$STAGING_API_ENDPOINT#g" ./ansible/docker-compose.yml
- name: Build Containers
env:
STAGING_API_ENDPOINT: ${{ secrets.STAGING_API_ENDPOINT }}
run: |
docker pull witnet/data-feed-app-ui:latest
docker pull witnet/data-feed-app-api:latest
docker build -t witnet/data-feed-app-ui:latest -f ./ansible/docker/ui.dockerfile ./packages/ui
docker build --build-arg API_ENDPOINT=${{ secrets.STAGING_API_ENDPOINT }} -t witnet/data-feed-app-ui:latest -f ./ansible/docker/ui.dockerfile ./packages/ui
docker build -t witnet/data-feed-app-api:latest -f ./ansible/docker/api.dockerfile ./packages/api
- name: Publish Containers
Expand Down
3 changes: 3 additions & 0 deletions ansible/docker/ui.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ EXPOSE 8080
ENV HOST=0.0.0.0
ENV PORT=8080

ARG API_ENDPOINT
ENV API_ENDPOINT=$API_ENDPOINT

RUN pnpm run build

CMD [ "node", ".output/server/index.mjs"]

0 comments on commit 41c744e

Please sign in to comment.