-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (84 loc) · 2.77 KB
/
Dockerfile
File metadata and controls
101 lines (84 loc) · 2.77 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
99
100
101
## Definite image args
ARG image_registry
ARG image_name=astra
ARG image_version=1.8.x-slim
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Base image #
# Init stage, install base application #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM ${image_registry}${image_name}:${image_version} AS base-stage
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
## Def initial arg(will be replaced with docker build opt)
ARG version=1.0.0
ARG httpd_identity=2.4.65
## Build args
ENV \
VERSION="${version}" \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TERM=linux \
TZ=Etc/UTC \
MALLOC_ARENA_MAX=2 \
APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 \
APACHE_RUN_DIR=/var/www/html
## Copy issue
COPY docs/issue /etc/issue
## Install build components
## Always use the latest version available for the current DEB distribution
# hadolint ignore=DL3027, SC2154
RUN \
--mount=type=bind,source=./scripts,target=/usr/local/sbin,readonly \
## Install httpd
httpd-install-approximately.sh "${httpd_identity}" \
## Deduplication cleanup
&& dedup-clean.sh /usr/
## Redirect file log to stdout/stderr fd
RUN \
ln -sf /dev/stdout /var/log/apache2/access.log \
&& ln -sf /dev/stderr /var/log/apache2/error.log
RUN \
## 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 \
## Spot system
&& echo "Minimal Apache HTTP Server container version ${VERSION}" >>/etc/issue
## Add launch process ep
COPY configuration/httpd-foreground /usr/local/bin/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 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' \
TERM='xterm-256color' \
TZ=Etc/UTC \
DEBIAN_FRONTEND='noninteractive' \
APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 \
APACHE_RUN_DIR=/var/www/html \
APACHE_PID_FILE=/run/apache2/httpd.pid
## Set work directory
WORKDIR /
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH
## Be gentle and expose port
EXPOSE 80
## Run app
CMD ["httpd-foreground"]