初步规划devstar模板

This commit is contained in:
2025-12-23 14:25:32 +08:00
parent 76c53e83d1
commit 23a9c87287
6 changed files with 49 additions and 61 deletions

View File

@@ -1,35 +0,0 @@
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 openssh-keygen openssh-client \
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
# 使用bash作为默认shell
SHELL ["/bin/bash", "-c"]
# 设置默认命令
CMD ["/bin/bash"]

View File

@@ -1,25 +0,0 @@
{
"name": "DevContainerExample",
"image": "mcr.microsoft.com/devcontainers/base:dev-ubuntu-20.04",
"postCreateCommand": "sudo apt-get install -y gdb",
"customizations": {
"vscode": {
"settings": {
"debug.onTaskErrors": "debugAnyway"
},
"extensions": [
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker"
]
}
},
"portsAttributes": {
"3000": {
"label": "Web Server",
"onAutoForward": "notify"
}
},
"initializeCommand": "gdb -ex 'set confirm off' -ex quit", // 初始化GDB配置
"postAttachCommand": "make debug"
}

View File

@@ -0,0 +1,13 @@
FROM docker.io/library/alpine:latest
# 安装开发工具合并RUN层减少镜像大小
RUN apk add --no-cache \
build-base \
openssh-server openssh-keygen openssh-client \
openrc \
git \
bash \
curl \
ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*

View File

@@ -0,0 +1,10 @@
FROM docker.io/library/ubuntu:latest
# 安装开发工具合并RUN层减少镜像大小
RUN apt-get update && apt-get install -y \
build-essential gdb git\
openssh-server \
bash sudo \
curl wget \
ca-certificates \
apt remove --purge curl -y && apt autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@@ -0,0 +1,25 @@
{
"name": "DevContainerExample",
"build": {
"dockerfile": "Dockerfile.ubuntu-latest"
},
"forwardPorts": [
"8080"
],
"initializeCommand": "echo \"initializeCommand\";",
"onCreateCommand": [
"echo \"onCreateCommand\";",
"echo \"onCreateCommand\";"
],
"postCreateCommand": [
"echo \"postCreateCommand\"",
"echo \"OK\""
],
"postAttachCommand": [
"echo \"postAttachCommand\"",
"echo \"OK\""
],
"runArgs": [
"-p 8888"
]
}

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🔍 Check out repository code
uses: https://devstar.cn/actions/checkout@v4
uses: actions/checkout@v4
- name: 🔧 Test Codes and Build an Artifact
run: |
set -e # 任何命令失败都停止执行