-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (35 loc) · 1.1 KB
/
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
44
45
46
47
48
#####################
### Runtime image ###
#####################
FROM node:16-slim
# Update packages
RUN apt-get update && apt-get install -y git curl procps htop net-tools netcat dnsutils
RUN npm install -g npm@latest
# Print Node.js & npm versions
RUN node --version
RUN npm --version
# Copy the required files
WORKDIR /usr/src/app
COPY .husky ./.husky
COPY pages ./pages
COPY public ./public
COPY src ./src
COPY next.config.js ./
COPY package*.json ./
COPY .next ./.next
COPY node_modules ./node_modules
# Enable APM Insight Node.js Agent
RUN mkdir -p /usr/src/app/apminsightdata && chown -R node:node /usr/src/app/apminsightdata
# Enable logging
RUN mkdir -p /var/log/nodejs && touch /var/log/nodejs/nodejs.log && chown -R node:node /var/log/nodejs
# Install dumb-init
RUN apt-get update && apt-get install -y dumb-init
# # Harden Image
# COPY ./harden.sh .
# RUN chmod +x harden.sh && \
# sh harden.sh && \
# rm -f harden.sh
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/bin/bash", "-c", "exec npm run start-web >> /var/log/nodejs/nodejs.log 2>&1"]
# Force container to run as a non-root user
USER node