Skip to content

Instantly share code, notes, and snippets.

@thesadabc
Last active December 16, 2022 08:58
Show Gist options
  • Save thesadabc/6f730b2a9d6899d5694287b548114189 to your computer and use it in GitHub Desktop.
Save thesadabc/6f730b2a9d6899d5694287b548114189 to your computer and use it in GitHub Desktop.
基础镜像构建模板,alpine与debian系统,包含时区及软件安装
FROM alpine:latest
ENV TZ=Asia/Shanghai
RUN \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache dumb-init build-base \
&& rm -rf /var/cache/apk/* /usr/share/man /tmp/*
ENTRYPOINT ["/usr/bin/dumb-init"]
FROM debian:bullseye
ENV TZ=Asia/Shanghai
RUN \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& sed -i 's/\(deb\|security\|snapshot\).debian.org/mirrors.aliyun.com/' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends dumb-init \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /usr/share/man /tmp/*
ENTRYPOINT ["/usr/bin/dumb-init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment