-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
35 lines (29 loc) · 879 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
30
31
32
33
34
35
FROM nginx:1.17
# install node 10 LTS
RUN apt-get -qq update && apt-get -qq --assume-yes install gnupg curl
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
RUN apt-get -qq --assume-yes install nodejs chromium libatk-adaptor gtk3.0
RUN alias node=/usr/bin/nodejs
RUN alias npm=/usr/bin/npm
RUN npm install yarn -g
# declare variables
ENV NGINX_DIR=/usr/share/nginx
ENV NGINX_CONF_DIR=/etc/nginx
ENV WORK_DIR=/usr/src/app
ENV BUILD_ENV=prod
ENV NODE_ENV=production
ENV INSTALL_OPTIONS=--silent
# configure and install dependencies
WORKDIR ${WORK_DIR}
COPY package.json ./
COPY yarn.lock ./
RUN export NODE_ENV=${NODE_ENV}
RUN yarn install ${INSTALL_OPTIONS}
COPY nginx.conf ${NGINX_CONF_DIR}
# copy and build project
COPY . ./
RUN yarn build:${BUILD_ENV}
# link project to nginx
RUN rm -rf ${NGINX_DIR}/html
RUN ln -s ${WORK_DIR}/public ${NGINX_DIR}/html
EXPOSE 80