* chore: inject enviroment at the deployment phase (#2174) * Dockerfile CMD env.sh * env.sh generates env-config.js file * index.html imports env-config.js * front/src/config/index.ts imports REACT_APP_SERVER_BASE_URL * Upgrade Dockerfiles * Add compute pg_database_url for render * fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
FROM node:18.16.0-alpine as build
|
||||
|
||||
|
||||
ARG REACT_APP_SERVER_BASE_URL
|
||||
ARG REACT_APP_SERVER_AUTH_URL
|
||||
ARG REACT_APP_SERVER_FILES_URL
|
||||
@ -18,10 +17,13 @@ COPY ./infra/prod/front/serve.json ./build
|
||||
FROM node:18.16.0-alpine as front
|
||||
|
||||
WORKDIR /app/front
|
||||
|
||||
COPY --from=build /app/front/build ./build
|
||||
COPY ./front/scripts/inject-runtime-env.sh /app/front/scripts/inject-runtime-env.sh
|
||||
|
||||
RUN yarn global add serve
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
||||
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the frontend."
|
||||
|
||||
CMD ["serve", "build"]
|
||||
CMD ["/bin/sh", "-c", "/app/front/scripts/inject-runtime-env.sh && serve build"]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM node:18.16.0-alpine as server
|
||||
FROM node:18.16.0-alpine as build
|
||||
|
||||
WORKDIR /app/server
|
||||
COPY ./server/package.json ./
|
||||
@ -11,6 +11,12 @@ RUN npx prisma generate
|
||||
|
||||
RUN yarn build
|
||||
|
||||
FROM node:18.16.0-alpine as server
|
||||
|
||||
COPY --from=build /app/server/dist ./dist
|
||||
|
||||
WORKDIR /app/server
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
|
||||
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend, ensuring it deploys faster and runs the same way regardless of the deployment environment."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user