forked from Wikia/mobile-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prod
More file actions
61 lines (47 loc) · 1.66 KB
/
Dockerfile.prod
File metadata and controls
61 lines (47 loc) · 1.66 KB
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
59
60
61
FROM node:8.9.1-alpine
WORKDIR /app
# passes IMAGE_VERSION build-arg to environment variable to use it in application
ARG IMAGE_VERSION
ARG GITHUB_TOKEN
ENV IMAGE_VERSION ${IMAGE_VERSION}
ENV GITHUB_TOKEN ${GITHUB_TOKEN}
# move files to cache installing of dependencies
COPY .npmrc .
COPY package-lock.json .
COPY package.json .
# create group and user
RUN addgroup -S mobile-wiki && \
adduser -h /app -s /sbin/nologin -D -G mobile-wiki -u 1337 docker_user && \
chmod 755 /app && \
# install missing stuff
apk add --no-cache --virtual .gyp python make g++ git && \
# override github's auth type
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf ssh://[email protected]/ && \
# related to upgrading ember to 3.0
npm cache clean --force && \
rm -rf node_modules/ && \
rm package-lock.json && \
# todo remove later | https://wikia-inc.atlassian.net/browse/XW-4817
# install all dependencies
npm set progress=false && \
npm run setup && \
# cleanup
apk del .gyp python make g++ git && \
npm cache clean --force
USER docker_user
# copy app
# Note:
# - first argument is the path inside the context of build (folder where Dockerfile is placed)
# - second argument is the docker daemon (newly created container)
# - "." means "current working directory", and since we're not selecting any specific files
# it's basically "copy everything from mobile-wiki project to WORKDIR in docker"
COPY . .
# build app
RUN npm run linter && \
# tests are broken for now
# npm run tests && \
npm run build-prod
# 8001 is for prod
EXPOSE 8001
# run fastboot-server when 'docker run' will be called
ENTRYPOINT ["npm", "run", "fastboot-server"]