Migrate to a monorepo structure (#2909)
This commit is contained in:
18
packages/twenty-docker/build/docs/Dockerfile
Normal file
18
packages/twenty-docker/build/docs/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM node:18.16.0-alpine as docs
|
||||
|
||||
WORKDIR /app/docs
|
||||
|
||||
ARG SHOULD_INDEX_DOC
|
||||
|
||||
COPY ./docs/package.json .
|
||||
COPY ./docs/yarn.lock .
|
||||
RUN yarn install
|
||||
|
||||
COPY ./docs .
|
||||
RUN npm run build
|
||||
|
||||
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 documentation."
|
||||
|
||||
CMD ["serve", "-s", "./build"]
|
||||
29
packages/twenty-docker/build/front/Dockerfile
Normal file
29
packages/twenty-docker/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"]
|
||||
6
packages/twenty-docker/build/front/serve.json
Normal file
6
packages/twenty-docker/build/front/serve.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rewrites": [
|
||||
{ "source": "!static/**", "destination": "/index.html" }
|
||||
],
|
||||
"directoryListing": false
|
||||
}
|
||||
45
packages/twenty-docker/build/postgres/Dockerfile
Normal file
45
packages/twenty-docker/build/postgres/Dockerfile
Normal file
@ -0,0 +1,45 @@
|
||||
ARG IMAGE_TAG='15.5.0-debian-11-r15'
|
||||
|
||||
FROM bitnami/postgresql:${IMAGE_TAG}
|
||||
|
||||
ARG PG_MAIN_VERSION=15
|
||||
ARG PG_GRAPHQL_VERSION=1.4.2
|
||||
ARG WRAPPERS_VERSION=0.2.0
|
||||
ARG TARGETARCH
|
||||
|
||||
USER root
|
||||
|
||||
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 curl -y
|
||||
|
||||
# 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
|
||||
RUN cp /usr/share/postgresql/${PG_MAIN_VERSION}/extension/pg_graphql* /opt/bitnami/postgresql/share/extension/
|
||||
RUN cp /usr/lib/postgresql/${PG_MAIN_VERSION}/lib/pg_graphql* /opt/bitnami/postgresql/lib/
|
||||
|
||||
# Install precompiled supabase wrappers extensions
|
||||
RUN curl -L "https://github.com/supabase/wrappers/releases/download/v${WRAPPERS_VERSION}/wrappers-v${WRAPPERS_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o wrappers.deb
|
||||
RUN dpkg --install wrappers.deb
|
||||
RUN cp /usr/share/postgresql/${PG_MAIN_VERSION}/extension/wrappers* /opt/bitnami/postgresql/share/extension/
|
||||
RUN cp /usr/lib/postgresql/${PG_MAIN_VERSION}/lib/wrappers* /opt/bitnami/postgresql/lib/
|
||||
|
||||
COPY ./infra/build/postgres/init.sql /docker-entrypoint-initdb.d/
|
||||
|
||||
USER 1001
|
||||
ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/entrypoint.sh" ]
|
||||
CMD [ "/opt/bitnami/scripts/postgresql/run.sh" ]
|
||||
10
packages/twenty-docker/build/postgres/init.sql
Normal file
10
packages/twenty-docker/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
|
||||
15
packages/twenty-docker/build/server/Dockerfile
Normal file
15
packages/twenty-docker/build/server/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
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 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"]
|
||||
Reference in New Issue
Block a user