-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
98 lines (84 loc) · 2.81 KB
/
Dockerfile
File metadata and controls
98 lines (84 loc) · 2.81 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
90
91
92
93
94
95
96
97
98
# syntax=docker/dockerfile:1.7-labs
## Definite image args
ARG image_registry
ARG image_name=astra
ARG image_version=1.8.2-slim
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Base image #
# First stage, prepare environment #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM ${image_registry}${image_name}:${image_version} AS base-stage
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
## Define DEFAULT args
ARG node_identity='18.19.0'
ARG npm_registry_proxy
ARG yarn_version='1.22.22'
## Copy issue
COPY docs/issue /etc/issue
## Create nodejs user space
RUN \
groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
## Install LP
RUN \
--mount=type=bind,source=./scripts,target=/usr/local/sbin,readonly \
apt-install.sh \
## Small init process
dumb-init \
&& node-install-approximately.sh "${node_identity}" \
## Set corporative proxy
&& node-set-proxy.sh 'npm' \
## Mock test
&& node --version \
&& npm --version \
## Install yarn
&& node-install-yarn.sh "${yarn_version}" \
## Set corporative proxy
&& node-set-proxy.sh 'yarn' \
## Remove unneeded component and cache
&& npm cache clean --force \
&& npm config --global set script-shell bash \
&& node-rm-unneeded.sh \
&& find "/usr/" -iname '*.exe' -ls -delete \
## Create link
&& ln -s "$(which node)" /usr/local/bin/nodejs \
## Deduplication cleanup
&& dedup-clean.sh /usr/ \
## Get image package dump
&& mkdir -p /usr/share/rocks \
&& ( \
echo "# os-release" && cat /etc/os-release \
&& echo "# dpkg-query" \
&& dpkg-query -f \
'${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' \
-W \
) >/usr/share/rocks/dpkg.query \
## Check can be preview /etc/issue
&& { \
grep -qF 'cat /etc/issue' /etc/bash.bashrc \
|| echo 'cat /etc/issue' >>/etc/bash.bashrc; \
}
## Copy entrypoint
COPY scripts/docker-entrypoint.sh /usr/local/sbin/docker-entrypoint.sh
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Final image #
# Second stage, compact optimize layer #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM scratch
COPY --from=base-stage / /
## Set base label
LABEL \
maintainer="Vladislav Avdeev" \
organization="NGRSoftlab"
## Set environment
ENV \
LANG='en_US.UTF8' \
LC_ALL='en_US.UTF8' \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
TERM='xterm-256color' \
TZ=Etc/UTC \
DEBIAN_FRONTEND='noninteractive'
## Set work directory
WORKDIR /
ENTRYPOINT [ "dumb-init", "docker-entrypoint.sh" ]
CMD [ "" ]