Files
docker-registry/alpine-base/Dockerfile.base
danial dc22011d51 chore(ci): 添加 alpine-base 镜像构建流水线和基础镜像文件
- 在 .drone.yml 中新增 alpine-base 镜像构建的 SSH Pipeline
- 添加基于阿里云镜像源和自定义证书的 Alpine 基础镜像 Dockerfile
- 创建构建基础镜像的脚本 build-base-image.sh,支持构建并推送镜像
- 新增 alpine-base 目录下的 README.md,详细说明镜像特点和使用方法
- 设置非 root 用户 appuser 及应用目录,提升安全性
- 支持根据 alpine-base 目录变更触发自动构建流程
2025-11-09 16:27:27 +08:00

58 lines
1.6 KiB
Docker

# Base Image for Alpine Linux applications
# Optimized Alpine base with Chinese mirrors, certificates, and common tools
FROM alpine:latest
# Set environment variables
ENV TZ=Asia/Shanghai
# Set up Alpine repositories (use China mirror for faster downloads)
RUN echo "https://mirrors.aliyun.com/alpine/v3.22/main/" > /etc/apk/repositories && \
echo "https://mirrors.aliyun.com/alpine/v3.22/community/" >> /etc/apk/repositories
# Install basic packages
RUN apk update && \
apk upgrade && \
apk add --no-cache \
# Time zone support
tzdata \
# Network tools
curl \
wget \
ca-certificates \
git \
# Compression
gzip \
tar \
# System tools
bash \
# Package management
apk-tools && \
# Set timezone
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
# Clean up
rm -rf /var/cache/apk/*
# Download custom certificates (skip problematic Alpine package)
RUN curl -fsSL -o /usr/local/share/ca-certificates/aaa-certificate-services.crt https://www.tbs-x509.com/Comodo_AAA_Certificate_Services.crt && \
update-ca-certificates
# Create non-root user
RUN addgroup -g 1001 -S appuser && \
adduser -u 1001 -S appuser -G appuser -h /app -s /bin/sh
# Create application directory
RUN mkdir -p /app && \
chown -R appuser:appuser /app
# Switch to appuser
USER appuser
# Set working directory
WORKDIR /app
# Label the image
LABEL maintainer="alpine-base-team" \
version="1.0.0" \
description="Optimized Alpine base image with Chinese mirrors, certificates, and common tools"