forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
99 lines (73 loc) · 2.76 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
FROM node:18.19-bullseye-slim AS base
# Use a cache mount for apt to speed up the process
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends \
openssh-client \
python3 \
g++ \
build-essential \
git && \
yarn config set python /usr/bin/python3 && \
npm install -g node-gyp
RUN npm i -g \
# Set the locale
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales \
locales-all \
libcap-dev \
&& rm -rf /var/lib/apt/lists/*
# install isolated-vm in a parent directory to avoid linking the package in every sandbox
RUN cd /usr/src && npm i [email protected]
RUN pnpm store add \
@tsconfig/[email protected] \
@types/[email protected] \
### STAGE 1: Build ###
FROM base AS build
# Set up backend
WORKDIR /usr/src/app
COPY . .
COPY .npmrc package.json package-lock.json ./
RUN npm ci
RUN npx nx run-many --target=build --projects=server-api --configuration production --skip-nx-cache
RUN npx nx run-many --target=build --projects=ui-core --configuration production --skip-nx-cache
# Install backend production dependencies
RUN cd dist/packages/server/api && npm install --production --force
### STAGE 2: Run ###
FROM base AS run
# Set up backend
WORKDIR /usr/src/app
COPY packages/server/api/src/assets/default.cf /usr/local/etc/isolate
# Install Nginx and gettext for envsubst
RUN apt-get update && apt-get install -y nginx gettext
# Copy Nginx configuration template
COPY packages/ui/core/nginx.standard.conf /etc/nginx/nginx.conf
COPY --from=build /usr/src/app/LICENSE .
RUN mkdir -p /usr/src/app/dist/packages/server/
RUN mkdir -p /usr/src/app/dist/packages/engine/
RUN mkdir -p /usr/src/app/dist/packages/shared/
# Copy Output files to appropriate directory from build stage
COPY --from=build /usr/src/app/dist/packages/engine/ /usr/src/app/dist/packages/engine/
COPY --from=build /usr/src/app/dist/packages/server/ /usr/src/app/dist/packages/server/
COPY --from=build /usr/src/app/dist/packages/shared/ /usr/src/app/dist/packages/shared/
RUN cd /usr/src/app/dist/packages/server/api/ && npm install --production --force
#
# Copy Output files to appropriate directory from build stage
COPY --from=build /usr/src/app/packages packages
LABEL service=activepieces
# Copy frontend files to Nginx document root directory from build stage
COPY --from=build /usr/src/app/dist/packages/ui/core/ /usr/share/nginx/html/
# Set up entrypoint script
COPY docker-entrypoint.sh .
RUN chmod +x docker-entrypoint.sh
ENTRYPOINT ["./docker-entrypoint.sh"]
EXPOSE 80