Files
base/.devcontainer/Dockerfile
孟宁 58d7bdd03f
All checks were successful
CI Pipeline / build (push) Successful in 2s
更新 .devcontainer/Dockerfile
2025-12-14 05:00:47 +00:00

38 lines
879 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM docker.io/library/alpine:3.22
LABEL maintainer="contact@mengning.com.cn"
LABEL version="1.0"
LABEL description="Alpine-based development environment"
# 设置环境变量
ENV WORKSPACE=/workspace \
USERNAME=devstar
# 创建非root用户提高安全性
RUN addgroup -g 1000 $USERNAME && \
adduser -u 1000 -G $USERNAME -s /bin/sh -D $USERNAME
# 安装开发工具合并RUN层减少镜像大小
RUN apk add --no-cache \
build-base \
openssh-server \
openrc \
git \
bash \
curl \
ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
# 创建工作目录并设置权限
WORKDIR $WORKSPACE
RUN mkdir -p $WORKSPACE && \
chown -R $USERNAME:$USERNAME $WORKSPACE
# 切换到非root用户
USER $USERNAME
# 使用bash作为默认shell
SHELL ["/bin/bash", "-c"]
# 设置默认命令
CMD ["/bin/bash"]