forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (66 loc) · 2.28 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
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
RUN npx nx run-many --target=build --projects=ui-core --configuration production
# 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 .
# Copy Output files to appropriate directory from build stage
COPY --from=build /usr/src/app/dist dist
# 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