Build render (#2188)
* Build for arm and amd * Add scripts * Add scripts
This commit is contained in:
29
infra/build/front/Dockerfile
Normal file
29
infra/build/front/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
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
|
||||
|
||||
COPY ./packages/ /app/packages
|
||||
|
||||
WORKDIR /app/front
|
||||
COPY ./front .
|
||||
|
||||
RUN yarn install
|
||||
RUN yarn build
|
||||
|
||||
COPY ./infra/build/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 ["/bin/sh", "-c", "/app/front/scripts/inject-runtime-env.sh && serve build"]
|
||||
30
infra/build/postgres/Dockerfile
Normal file
30
infra/build/postgres/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
ARG PG_MAIN_VERSION=14
|
||||
|
||||
FROM postgres:${PG_MAIN_VERSION} as postgres
|
||||
|
||||
ARG PG_MAIN_VERSION
|
||||
ARG PG_GRAPHQL_VERSION=1.3.0
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN set -eux; \
|
||||
ARCH="$(dpkg --print-architecture)"; \
|
||||
case "${ARCH}" in \
|
||||
aarch64|arm64) \
|
||||
TARGETARCH='arm64'; \
|
||||
;; \
|
||||
amd64|x86_64) \
|
||||
TARGETARCH='amd64'; \
|
||||
;; \
|
||||
*) \
|
||||
echo "Unsupported arch: ${ARCH}"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac;
|
||||
|
||||
RUN apt update && apt install -y curl
|
||||
|
||||
# Install precompiled pg_graphql extensions
|
||||
RUN curl -L "https://github.com/supabase/pg_graphql/releases/download/v${PG_GRAPHQL_VERSION}/pg_graphql-v${PG_GRAPHQL_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o pg_graphql.deb
|
||||
RUN dpkg --install pg_graphql.deb
|
||||
|
||||
COPY ./infra/prod/postgres/init.sql /docker-entrypoint-initdb.d/
|
||||
10
infra/build/postgres/init.sql
Normal file
10
infra/build/postgres/init.sql
Normal file
@ -0,0 +1,10 @@
|
||||
SELECT 'CREATE DATABASE "default"'
|
||||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'default')\gexec
|
||||
|
||||
SELECT 'CREATE DATABASE "test"'
|
||||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'test')\gexec
|
||||
|
||||
SELECT 'CREATE USER twenty PASSWORD ''twenty'''
|
||||
WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'twenty')\gexec
|
||||
|
||||
SELECT 'ALTER ROLE twenty superuser'\gexec
|
||||
17
infra/build/server/Dockerfile
Normal file
17
infra/build/server/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:18.16.0-alpine as build
|
||||
|
||||
WORKDIR /app/server
|
||||
COPY ./server/package.json ./
|
||||
COPY ./server/yarn.lock ./
|
||||
COPY ./server/patches ./patches
|
||||
RUN yarn install
|
||||
|
||||
COPY ./server .
|
||||
RUN npx prisma generate
|
||||
|
||||
RUN yarn build
|
||||
|
||||
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."
|
||||
|
||||
CMD ["node", "dist/src/main"]
|
||||
@ -1,29 +1,3 @@
|
||||
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
|
||||
|
||||
COPY ./packages/ /app/packages
|
||||
|
||||
WORKDIR /app/front
|
||||
COPY ./front .
|
||||
|
||||
RUN yarn install
|
||||
RUN yarn build
|
||||
|
||||
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."
|
||||
FROM --platform=linux/amd64 twentycrm/twenty-front as front
|
||||
|
||||
CMD ["/bin/sh", "-c", "/app/front/scripts/inject-runtime-env.sh && serve build"]
|
||||
|
||||
@ -1,23 +1,3 @@
|
||||
FROM node:18.16.0-alpine as build
|
||||
|
||||
WORKDIR /app/server
|
||||
COPY ./server/package.json ./
|
||||
COPY ./server/yarn.lock ./
|
||||
COPY ./server/patches ./patches
|
||||
RUN yarn install
|
||||
|
||||
COPY ./server .
|
||||
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."
|
||||
FROM --platform=linux/amd64 twentycrm/twenty-server as server
|
||||
|
||||
CMD ["node", "dist/src/main"]
|
||||
|
||||
5
infra/release/build-front.sh
Executable file
5
infra/release/build-front.sh
Executable file
@ -0,0 +1,5 @@
|
||||
|
||||
docker buildx build \
|
||||
--push \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f ./infra/build/front/Dockerfile -t twentycrm/twenty-front:0.1.5 -t twentycrm/twenty-front:latest .
|
||||
5
infra/release/build-server.sh
Executable file
5
infra/release/build-server.sh
Executable file
@ -0,0 +1,5 @@
|
||||
|
||||
docker buildx build \
|
||||
--push \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f ./infra/build/server/Dockerfile -t twentycrm/twenty-server:0.1.5 -t twentycrm/twenty-server:latest .
|
||||
Reference in New Issue
Block a user