-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
23 lines (22 loc) · 813 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
FROM node:10.5.0-alpine AS builder
WORKDIR /app
RUN apk add --update git python2 make g++
# Add sources
ADD package.json package-lock.json ./
# https://docs.npmjs.com/cli/install
ENV CI=true \
NPM_CONFIG_LOGLEVEL=error \
NODE_ENV=production \
BABEL_ENV=production \
GENERATE_SOURCEMAP=true \
GENERATE_ANALYSISMAP=true
RUN npm install --production
COPY . .
ADD nginx/scripts/prepare.sh /
# Test, build and prepare
RUN npm test && npm run build && chmod +x /prepare.sh && /prepare.sh
FROM nginx:alpine
COPY nginx/etc/nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html
CMD /bin/sh -c "sed -i 's/listen 80/listen ${PORT}/g' /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'