Skip to content

Commit

Permalink
fix: set DATABASE_URL and HOSTNAME correctly for next services (#684)
Browse files Browse the repository at this point in the history
* fix: restore building the base image, as we need it for migrations

* feat: make ECS deploy task wait until service is stable

* fix: manually set the hostname to 0.0.0.0 to avoid weird errors when deploying to ecs

* fix: copy over docker env file to set DATABASE_URL correctly when
deploying
  • Loading branch information
tefkah authored Oct 3, 2024
1 parent 98b968d commit bbfb912
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,18 @@ EXPOSE $PORT
# Use production node environment by default.
ENV NODE_ENV production

# otherwise it will use the strange default docker hostname
ENV HOSTNAME "0.0.0.0"

### Core

FROM prod-setup AS next-app-core
WORKDIR /usr/src/app
COPY --from=withpackage --chown=node:node /usr/src/app/core/.next/standalone ./
COPY --from=withpackage --chown=node:node /usr/src/app/core/.next/static ./core/.next/static
COPY --from=withpackage --chown=node:node /usr/src/app/core/public ./core/public
# needed to set the database url correctly based on PGHOST variables
COPY --from=withpackage --chown=node:node /usr/src/app/core/.env.docker ./core/.env

CMD node core/server.js

Expand All @@ -132,6 +137,8 @@ WORKDIR /usr/src/app
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/submissions/.next/standalone .
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/submissions/.next/static ./integrations/evaluations/.next/static
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/submissions/public ./integrations/evaluations/public
# needed to set the database url correctly based on PGHOST variables
COPY --from=withpackage --chown=node:node /usr/src/app/core/.env.docker ./integrations/evaluations/.env

CMD node integrations/submissions/server.js

Expand All @@ -142,6 +149,8 @@ WORKDIR /usr/src/app
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/evaluations/.next/standalone ./
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/evaluations/.next/static ./integrations/submissions/.next/static
COPY --from=withpackage --chown=node:node /usr/src/app/integrations/evaluations/public ./integrations/submissions/public
# needed to set the database url correctly based on PGHOST variables
COPY --from=withpackage --chown=node:node /usr/src/app/core/.env.docker ./integrations/submissions/.env

CMD node integrations/evaluations/server.js

0 comments on commit bbfb912

Please sign in to comment.