-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
29 lines (24 loc) · 1022 Bytes
/
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
ARG env
FROM mhart/alpine-node:8.12 AS alpine-base
WORKDIR /usr/src/app
COPY ["./nginx.conf", "./newsquirrel.com", "./"]
FROM alpine-base AS production-essentials
RUN apk update && apk add --no-cache certbot && \
mkdir /run/nginx && apk add --no-cache nginx && \
adduser -D -g 'www' www && mkdir /var/www/newsquirrel && \
mkdir /etc/nginx/sites-available && mkdir /etc/nginx/sites-enabled && \
yes | cp -rf ./nginx.conf /etc/nginx/ && cp ./newsquirrel.com /etc/nginx/sites-available/ && \
ln -s /etc/nginx/sites-available/newsquirrel.com /etc/nginx/sites-enabled/newsquirrel.com && \
rm /etc/nginx/conf.d/default.conf && \
rm -rf /var/cache/apk
FROM alpine-base AS development-build
COPY . .
RUN npm install --development
FROM production-essentials AS production-build
COPY . .
RUN npm install --production && npm run build && cp -a ./build/. /var/www/newsquirrel && \
mv ./run.sh ../ && cd .. && rm -r ./app/* && mv ./run.sh ./app
FROM ${env}-build
ARG env
ENV env=${env}
ENTRYPOINT [ "./run.sh" ]