This repository was archived by the owner on Apr 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
89 lines (61 loc) · 1.76 KB
/
Dockerfile
File metadata and controls
89 lines (61 loc) · 1.76 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# ---- Base ----
FROM centos:7.7.1908 as base
# Change shell from 'sh' to 'bash'
SHELL [ "/bin/bash", "-c" ]
# Install required system dependencies
RUN yum install --quiet --assumeyes \
bzip2 \
gcc \
g++ \
gcc-c++ \
make
# Install required pdflatex dependencies
RUN yum install --quiet --assumeyes \
texlive \
texlive-*.noarch
#
# ---- Node Version Manager ----
FROM base as nvm
# Specify the required versions of NodeJS and Node Version Manager
ENV NVM_VERSION=v0.35.2
ENV NODE_VERSION=12.14.1
# Specifiy the NVM install directory
ENV NVM_DIR=/root/.nvm
# Installs NVM which will automatically install NodeJS and NPM
RUN curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash
# Add the just installed NodeJS and NPM to the PATH
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
#
# ---- Node ----
FROM nvm as node
# Create app directory
WORKDIR /usr/src/app
#
# ---- Development ----
FROM node as development
# Expose the port to the Docker instance (not the host!).
EXPOSE 3000
# Run start script as specified in package.json
CMD [ "npm", "run", "start:dev" ]
#
# ---- Dependency ----
FROM node as dependencies
# Copy package.json and package-lock.json to the container.
COPY package*.json ./
# Installs modules from package-lock.json, this ensures reproducible build.
RUN npm --silent ci
#
# ---- Build ----
FROM dependencies as build
# Copy all files, except those ignored by .dockerignore, to the container.
COPY . .
RUN npm run build
#
# ---- Release ----
FROM build as production
# Expose the port to the Docker instance (not the host!).
EXPOSE 3000
# Run start script as specified in package.json
CMD [ "npm", "run", "start:prod" ]