forked from Wikia/mobile-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.prod
58 lines (44 loc) · 1.38 KB
/
Dockerfile.prod
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
52
53
54
55
56
57
58
FROM node:12.19.0-alpine as depsInstaller
RUN apk add --no-cache --virtual .gyp make g++ git
WORKDIR /app
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN ${GITHUB_TOKEN}
COPY package.json .
COPY package-lock.json .
COPY .npmrc .
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf ssh://[email protected]/ && \
# install all dependencies
npm set unsafe-perm=true && \
npm set progress=false && \
npm run setup && \
# cleanup
npm cache clean --force
ARG IMAGE_VERSION
ENV IMAGE_VERSION ${IMAGE_VERSION}
COPY . .
RUN npm run build-prod && \
rm -rf node_modules/.cache && \
rm -rf node_modules/webpack* && \
rm -rf node_modules/*webpack* && \
rm -rf node_modules/babel* && \
rm -rf node_modules/@babel && \
rm -rf node_modules/broccoli* && \
rm -rf node_modules/terser && \
rm -rf node_modules/caniuse* && \
rm -rf node_modules/rollup* && \
rm -rf node_modules/stylelint* && \
rm -rf node_modules/eslint* && \
rm -rf node_modules/sinon && \
rm -rf node_modules/@sinonjs && \
rm -rf node_modules/ember-sinon && \
rm -rf node_modules/prettier && \
rm -rf node_modules/ember-cli*
FROM node:12.19.0-alpine
ARG IMAGE_VERSION
ENV IMAGE_VERSION ${IMAGE_VERSION}
USER 65534
COPY --from=depsInstaller /app /app
WORKDIR /app
# 8001 is for prod, 8007 is for metrics
EXPOSE 8001 8007
CMD ["npm", "run", "fastboot-server"]