Skip to content

Commit b0c4a4e

Browse files
committed
docker build ready
1 parent 84b6635 commit b0c4a4e

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
node_modules/
3+
.env*
4+
.git/

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:erbium-alpine3.11 as build
2+
3+
RUN mkdir /code
4+
WORKDIR /code
5+
ENV PATH /code/node_modules/.bin:$PATH
6+
COPY package.json yarn.lock /code/
7+
RUN yarn install --prod --pure-lockfile
8+
9+
# build the site
10+
FROM build as app
11+
COPY . /code
12+
RUN yarn run build
13+
14+
# production environment
15+
FROM nginx:1.16.0-alpine
16+
COPY --from=app /code/build /usr/share/nginx/html
17+
RUN rm /etc/nginx/conf.d/default.conf
18+
COPY infra/nginx.conf /etc/nginx/conf.d
19+
EXPOSE 8000
20+
CMD ["nginx", "-g", "daemon off;"]

infra/nginx.conf

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
3+
listen 8000;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html index.htm;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
11+
error_page 500 502 503 504 /50x.html;
12+
13+
location = /50x.html {
14+
root /usr/share/nginx/html;
15+
}
16+
17+
}

0 commit comments

Comments
 (0)