Support both build-time and run-time values for WEBAPP_URL. Improve re-build time, if just the WEBAPP_URL is changed.
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -8,9 +8,7 @@ ARG NEXTAUTH_SECRET=secret
|
||||
ARG CALENDSO_ENCRYPTION_KEY=secret
|
||||
ARG MAX_OLD_SPACE_SIZE=4096
|
||||
|
||||
# PLACEHOLDER value is compiled in during build, but will be replaced it at runtime
|
||||
# see: scripts/replace-placeholders.sh
|
||||
ENV NEXT_PUBLIC_WEBAPP_URL=https://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER \
|
||||
ENV NEXT_PUBLIC_WEBAPP_URL=http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER \
|
||||
NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT \
|
||||
CALCOM_TELEMETRY_DISABLED=$CALCOM_TELEMETRY_DISABLED \
|
||||
DATABASE_URL=$DATABASE_URL \
|
||||
@@ -30,6 +28,8 @@ RUN yarn build
|
||||
FROM node:16 as runner
|
||||
|
||||
WORKDIR /calcom
|
||||
ARG NEXT_PUBLIC_WEBAPP_URL=http://localhost:3000
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
RUN apt-get update && \
|
||||
@@ -44,5 +44,12 @@ COPY --from=builder /calcom/apps/web ./apps/web
|
||||
COPY --from=builder /calcom/packages/prisma/schema.prisma ./prisma/schema.prisma
|
||||
COPY scripts scripts
|
||||
|
||||
# Save value used during this build stage. If NEXT_PUBLIC_WEBAPP_URL and BUILT_NEXT_PUBLIC_WEBAPP_URL differ at
|
||||
# run-time, then start.sh will find/replace static values again.
|
||||
ENV NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL \
|
||||
BUILT_NEXT_PUBLIC_WEBAPP_URL=$NEXT_PUBLIC_WEBAPP_URL
|
||||
|
||||
RUN scripts/replace-placeholder.sh http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER ${NEXT_PUBLIC_WEBAPP_URL}
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["/calcom/scripts/start.sh"]
|
||||
|
||||
Reference in New Issue
Block a user