From bbfb912f6bf829b6a46a5181cfabca2abdaa26bc Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Thu, 3 Oct 2024 19:04:51 +0200 Subject: [PATCH] fix: set DATABASE_URL and HOSTNAME correctly for next services (#684) * 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 --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 3d8e91a58..64d493da1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -115,6 +115,9 @@ 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 @@ -122,6 +125,8 @@ 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 @@ -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 @@ -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