-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.repl
51 lines (39 loc) · 1.46 KB
/
Dockerfile.repl
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
FROM ubuntu:21.04
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get install -y curl gnupg2
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update \
&& apt-get install -y supervisor yarn nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
RUN mkdir -p /opt/app
# Install web dependencies first, we will build the application later
ADD diggy-repl/package.json /usr/src/app
ADD diggy-repl/yarn.lock /usr/src/app
RUN yarn
# Socket server
ADD diggy-repl/package.json /opt/app/
ADD diggy-repl/yarn.lock /opt/app/
RUN cd /opt/app && yarn install --production
ADD diggy-repl/src/lib /opt/app/lib
ADD diggy-repl/src/server.js /opt/app/
ADD .env /opt/app/.env
# Build application
# NOTE: this is ugly, it will invalidate cache layer even there are
# changes not realted to web app
ADD diggy-repl /usr/src/app
ADD .env /usr/src/app/.env
RUN yarn build
# Web interface
RUN cp -r /usr/src/app/build /opt/app
# Supervisord
ADD diggy-repl/docker/supervisord.conf /etc/
RUN mkdir -p /etc/supervisor/conf.d
# Copy web app supervisord conf
ADD diggy-repl/docker/web.conf /etc/supervisor/conf.d/
# Copy web socket supervisord conf
ADD diggy-repl/docker/socket.conf /etc/supervisor/conf.d/
ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisord.conf"]