-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.Dockerfile
98 lines (88 loc) · 3.82 KB
/
template.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
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
90
91
92
93
94
95
96
97
98
FROM node:${NODE_VERSION}-bookworm-slim
LABEL maintainer="Lubomir Stanko <[email protected]>"
# ----------------------------------------------------------------------------------------------------------------------
# ENVIRONMENT VARIABLES
# ----------------------------------------------------------------------------------------------------------------------
# Common environment variables
ENV CONFIG_OWNER_NAME=node \
CONFIG_GROUP_NAME=node \
CONTAINER_STOP_LOG_FILE="/var/www/html/var/log/container_stop.log" \
COREPACK_HOME="/usr/lib/node/corepack" \
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
MAIN_TERMINATED_FILE="/var/www/html/var/log/main-terminated" \
NPM_CONFIG_LOGLEVEL=notice \
YARN_CACHE_FOLDER="/var/cache/yarn" \
YARN_ENABLE_TELEMETRY=0 \
# Unset yarn version - it could break CI and we don't need it
YARN_VERSION=
# Packages
ENV RUN_DEPS="ca-certificates \
curl \
g++ \
gcc \
gettext-base \
git \
gnupg \
less \
logrotate \
lsb-release \
make \
openssh-client \
procps \
vim \
wget"
# ----------------------------------------------------------------------------------------------------------------------
# PACKAGES
# ----------------------------------------------------------------------------------------------------------------------
RUN apt-get update && \
APT_SUPERVISOR_VERSION=$(apt-cache madison supervisor | awk -v ver="${SUPERVISOR_VERSION}" '$3 ~ ver {print $3; exit}') && \
apt-get install -y \
${RUN_DEPS} \
supervisor=${APT_SUPERVISOR_VERSION} && \
# Cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# ----------------------------------------------------------------------------------------------------------------------
# NPM
# Install static npm version
# ----------------------------------------------------------------------------------------------------------------------
RUN npm install --location=global npm@latest && \
npm install --location=global auditjs@latest && \
mkdir -p ${COREPACK_HOME} && \
corepack prepare yarn@stable --activate && \
corepack enable && \
# Node cache cleanup
npm cache clean --force && \
yarn cache clean --all
# ----------------------------------------------------------------------------------------------------------------------
# USER SETUP
# ----------------------------------------------------------------------------------------------------------------------
RUN sed -i 's/^#alias l/alias l/g' /home/node/.bashrc && \
echo "update-notifier=false" > /home/node/.npmrc && \
mkdir -p \
${YARN_CACHE_FOLDER} \
/usr/local/lib/node_modules \
/var/run/supervisor \
/var/www/html/var && \
chown node:node -R \
${COREPACK_HOME} \
${YARN_CACHE_FOLDER} \
/home/node/.npmrc \
/usr/local/bin \
/usr/local/lib/node_modules \
/var/run/supervisor \
/var/www/html
##<autogenerated>##
##</autogenerated>##
# ----------------------------------------------------------------------------------------------------------------------
# RUN CONFIGURATION
# ----------------------------------------------------------------------------------------------------------------------
COPY --chown=${CONFIG_OWNER_NAME}:${CONFIG_GROUP_NAME} ./etc /etc
COPY --chown=${CONFIG_OWNER_NAME}:${CONFIG_GROUP_NAME} ./usr /usr
# ----------------------------------------------------------------------------------------------------------------------
# RUN
# Run setup and entrypoint start
# ----------------------------------------------------------------------------------------------------------------------
WORKDIR /var/www/html
USER node
ENTRYPOINT ["docker-custom-entrypoint"]