-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (48 loc) · 1.6 KB
/
Dockerfile
File metadata and controls
63 lines (48 loc) · 1.6 KB
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
FROM alpine:latest AS base
ENV NODE_ENV="development"
# where the incoming source code will be saved temporarily
ENV SANDBOX_DIR="/tmp/sandbox"
RUN apk add --no-cache bash bash-doc bash-completion
RUN apk add --no-cache build-base
RUN apk add --no-cache bash
RUN apk add --no-cache curl
RUN apk add --no-cache openjdk11
RUN apk add --no-cache php7
RUN apk add --no-cache nodejs npm
RUN apk add --no-cache python3 py3-pip
ENV FPC_VERSION="3.2.2"
ENV FPC_ARCH="x86_64-linux"
RUN apk add --no-cache binutils && \
cd /tmp && \
wget "ftp://ftp.hu.freepascal.org/pub/fpc/dist/${FPC_VERSION}/${FPC_ARCH}/fpc-${FPC_VERSION}.${FPC_ARCH}.tar" -O fpc.tar && \
tar xf "fpc.tar" && \
cd "fpc-${FPC_VERSION}.${FPC_ARCH}" && \
rm demo* doc* && \
\
mkdir /lib64 && \
ln -s /lib/ld-musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
\
echo -e '/usr\nN\nN\nN\n' | sh ./install.sh && \
find "/usr/lib/fpc/${FPC_VERSION}/units/${FPC_ARCH}/" -type d -mindepth 1 -maxdepth 1 \
-not -name 'fcl-base' \
-not -name 'rtl' \
-not -name 'rtl-console' \
-not -name 'rtl-objpas' \
-exec rm -r {} \; && \
rm -r "/lib64" "/tmp/"*
WORKDIR /app/sandbox
COPY package.json ./
RUN npm install
COPY ./ ./
################################
# To be run only in production #
################################
FROM base AS production
ENV NODE_ENV="production"
# how many milliseconds maximum the server will spend in a shell execution
ENV SANDBOX_TIMEOUT=10000
RUN npm install -g pm2
RUN rm build/ -rf
RUN npm run build
EXPOSE $PORT
CMD ["pm2-runtime", "start", "build/index.js"]