-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (56 loc) · 1.77 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ARG BASE_IMAGE=debian:12-slim
# hadolint ignore=DL3006
FROM $BASE_IMAGE
ARG IS_SLIM=
ARG LOCALE_LANGUAGE=zh
ARG LOCALE_COUNTRY=CN
ARG LOCALE_CHARMAP=UTF-8
ARG LOCALE_TIMEZONE=Asia/Shanghai
ENV LANG ${LOCALE_LANGUAGE}_${LOCALE_COUNTRY}.${LOCALE_CHARMAP}
ENV TZ ${LOCALE_TIMEZONE}
# for DL4006: https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -o errexit -o nounset -o xtrace \
&& apt-get update \
# 设置语言环境
&& apt-get install -y --no-install-recommends \
locales=* \
&& localedef -i ${LOCALE_LANGUAGE}_${LOCALE_COUNTRY} -c -f ${LOCALE_CHARMAP} -A /usr/share/locale/locale.alias ${LOCALE_LANGUAGE}_${LOCALE_COUNTRY}.${LOCALE_CHARMAP} \
&& update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales \
&& echo "${LANG} ${LOCALE_CHARMAP}" >> /etc/locale.gen \
&& locale-gen \
# 设置时区
&& ln -sf /usr/share/zoneinfo/${LOCALE_TIMEZONE} /etc/localtime \
# 安装 GnuPG
&& apt-get install -y --no-install-recommends --no-install-suggests \
gnupg=* \
# 升级重要的或者有安全漏洞的软件包
&& apt-get upgrade -y \
apt=* \
ca-certificates=* \
tzdata=* \
# 安装常用工具
&& if [ "${IS_SLIM}" == '' ]; then \
apt-get install -y --no-install-recommends --no-install-suggests \
bash-completion=* \
bzip2=* \
curl=* \
dnsutils=* \
gettext=* \
htop=* \
iputils-ping=* \
less=* \
nano=* \
openssh-client=* \
sudo=* \
telnet=* \
unzip=* \
vim=* \
wget=* \
xz-utils=* \
zip=* \
; \
fi \
# APT清理
&& rm -rf /var/lib/apt/lists/*