-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile-alpine
49 lines (34 loc) · 1.19 KB
/
Dockerfile-alpine
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
FROM node:16-alpine
WORKDIR /data/engine
# confirm installation
RUN node -v
RUN npm -v
ARG CONFIG_URL
ARG PM2_PUBLIC_KEY
ARG PM2_SECRET_KEY
ARG ENV
#install pm2 to production (monitoring)
RUN npm install pm2 -g
#install nodemon to dev (support hot realoading) (need specific command in compose)
RUN npm install nodemon -g
ENV CONFIG_URL=$CONFIG_URL
ENV PM2_PUBLIC_KEY=$PM2_PUBLIC_KEY
ENV PM2_SECRET_KEY=$PM2_SECRET_KEY
ENV BROADCAST_LOGS 1
ENV FORCE_INSPECTOR 1
# install tool for npm lib compile in C
RUN apk add --update --no-cache autoconf libtool automake python3 py3-pip alpine-sdk
RUN apk update && apk add bash
# Install app dependencies
COPY ./engine/package.json /data/
RUN cd /data/ && npm cache clean --force && npm install --loglevel verbose
RUN curl https://raw.githubusercontent.com/eficode/wait-for/v2.2.3/wait-for --create-dirs -o /data/scripts/wait-for-it.sh
RUN chmod u+x /data/scripts/wait-for-it.sh
# add src & build configuraiton
COPY ./core /data/core/
COPY ./engine /data/engine/
COPY ./wait-for-it.sh /data/scripts/
COPY ./wait-for.sh /data/scripts/
# Expose ports (for orchestrators and dynamic reverse proxies)
EXPOSE 8080
CMD [ "pm2-runtime", "app.js", "--name" ,"engine"]