土小帽 发表于 2023-11-3 21:46:57

alpine(Go环境)Docker基础镜像制作

拉取官方alpine[*]docker pull alpine:latest复制代码
安装glibc
参考:https://github.com/sgerrand/alpine-pkg-glibc/

设置时区[*]RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
[*]https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories
[*]# Install base packages
[*]RUN apk update && apk --no-cache add tzdata ca-certificates wget \
[*]    && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime复制代码
制作基础镜像
Dockerfile[*]FROM alpine:latest
[*]RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/main\n\
[*]https://mirror.tuna.tsinghua.edu.cn/alpine/latest-stable/community" > /etc/apk/repositories
[*]# Install base packages
[*]RUN apk update && apk --no-cache add tzdata ca-certificates wget \
[*]    && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[*]RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk&& apk add glibc-2.27-r0.apk && rm -f glibc-2.27-r0.apk /etc/apk/keys/sgerrand.rsa.pub复制代码[*]docker build -t hub.linuxeye.com/library/alpine:latest .   #生成镜像
[*]docker push hub.linuxeye.com/library/alpine:latest      #推送私有仓库复制代码
页: [1]
查看完整版本: alpine(Go环境)Docker基础镜像制作