Skip to content

Commit

Permalink
allow .env in different folder
Browse files Browse the repository at this point in the history
  • Loading branch information
eliobischof committed Feb 11, 2025
1 parent c74e825 commit 533e8a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

RUN mkdir /cfg
RUN ln -s .env /cfg/.env

USER nextjs
# If /.env-file/.env is mounted into the container, its variables are made available to the server before it starts up.
RUN mkdir -p /.env-file && touch /.env-file/.env && chown -R nextjs:nodejs /.env-file

COPY --chown=nextjs:nodejs ./docker/apps/login/.next/standalone ./
COPY --chown=nextjs:nodejs ./docker/apps/login/.next/static ./apps/login/.next/static
COPY --chown=nextjs:nodejs ./docker/apps/login/public ./apps/login/public

USER nextjs
ENV HOSTNAME="0.0.0.0"
CMD node apps/login/server.js

CMD ["/bin/sh", "-c", " set -o allexport && . /.env-file/.env && set +o allexport && node apps/login/server.js"]

0 comments on commit 533e8a2

Please sign in to comment.