forked from jonahjon/container-app-security-cicd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 989 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
### Our base image
FROM amazonlinux
### Update our image
RUN yum update -y
### Install tar & gzip
RUN yum install -y tar gzip shadow-utils
### Install NVM
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14.18.1
RUN curl -s -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# Add app port
ENV CLUSTER_SAMPLE_APP_PORT 3000
#### Create app directory
WORKDIR /usr/src/app
#### Install app dependencies
COPY src/package*.json ./
#### Install our packages
RUN npm install
#### Bundle app source
COPY . .
#### Configure container
EXPOSE 3000
HEALTHCHECK CMD curl --fail http://localhost:3000/healthcheck || exit 1
CMD [ "node", "src/app.js" ]