Update api image Dockerfile (#13890)

- Add DATABASE_URL and DATABASE_DIRECT_URL, used during build
- Copy tests folder, referenced by code run during build.
This commit is contained in:
David Somers authored and GitHub committed 2024-03-01 09:18:02 -03:00
1 parent 83fe4d6625
commit 5b733765f4
1 file changed
+7 -3
+7 -3
View File
@@ -4,12 +4,15 @@
ARG NODE_VERSION=20.7.0
FROM node:${NODE_VERSION}-slim as base
ARG DATABASE_URL
# Next.js/Prisma app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
ENV NODE_ENV="production" \
DATABASE_URL=$DATABASE_URL \
DATABASE_DIRECT_URL=$DATABASE_URL
# Throw-away build stage to reduce size of final image
FROM base as build
@@ -21,6 +24,7 @@ COPY ./apps/api ./apps/api
COPY ./packages ./packages
# TODO: follow up pr to remove dependencies on web
COPY ./apps/web ./apps/web
COPY ./tests ./tests
# Install node modules and dependencies, prune unneeded deps, then build
RUN set -eux; \
@@ -66,4 +70,4 @@ COPY --from=build /app/apps/web/package.json ./apps/web/package.json
EXPOSE 80
# Start cmd, called when docker image is mounted
CMD [ "yarn", "workspace", "@calcom/api", "docker-start-api"]
CMD [ "yarn", "workspace", "@calcom/api", "docker-start-api"]