Skip to content

Commit

Permalink
fix(docker): add build time env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagomichaelsousa committed Jul 10, 2023
1 parent 60f4102 commit eb90d97
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/on-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ jobs:
type=registry,ref=${{ ENV.REGISTRY }}:${{ env.TAG }}
type=registry,ref=${{ ENV.REGISTRY }}:${{ env.TAG }}:cache
cache-to: type=inline
build-args: |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}
API_URL=${{ vars.API_URL }}
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_SOCKET_URL=${{ vars.NEXT_PUBLIC_SOCKET_URL }}
deploy-production:
name: Deploy
Expand Down
3 changes: 3 additions & 0 deletions packages/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ RUN apk --update add \
WORKDIR /app

COPY ./api/package.json ./api/package.json
COPY ./api/package-lock.json ./api/package-lock.json

COPY ./contract/package.json ./contract/package.json
COPY ./contract/package-lock.json ./contract/package-lock.json

RUN cd api && npm install
RUN cd contract && npm install
Expand Down
32 changes: 32 additions & 0 deletions packages/web-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY ./web-ui/package.json ./web-ui/package.json
COPY ./web-ui/package-lock.json ./web-ui/package-lock.json

RUN cd web-ui && npm install

COPY ./contract/package.json ./contract/package.json
COPY ./contract/package-lock.json ./contract/package-lock.json

RUN cd contract && npm install

Expand All @@ -31,6 +33,21 @@ COPY ./contract ./contract
# Comment the following line in case you want to enable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
ENV NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY $NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY

ARG CLERK_SECRET_KEY
ENV CLERK_SECRET_KEY $CLERK_SECRET_KEY

ARG API_URL
ENV API_URL $API_URL

ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL $NEXT_PUBLIC_API_URL

ARG NEXT_PUBLIC_SOCKET_URL
ENV NEXT_PUBLIC_SOCKET_URL $NEXT_PUBLIC_SOCKET_URL

# 3. Install only production dependencies
RUN cd web-ui && npm run build

Expand All @@ -48,6 +65,21 @@ WORKDIR /app

ENV NODE_ENV production

ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
ENV NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY $NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY

ARG CLERK_SECRET_KEY
ENV CLERK_SECRET_KEY $CLERK_SECRET_KEY

ARG API_URL
ENV API_URL $API_URL

ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL $NEXT_PUBLIC_API_URL

ARG NEXT_PUBLIC_SOCKET_URL
ENV NEXT_PUBLIC_SOCKET_URL $NEXT_PUBLIC_SOCKET_URL

# Comment the following line in case you want to enable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1

Expand Down

0 comments on commit eb90d97

Please sign in to comment.