Compare commits

10 Commits
main ... main

6 changed files with 49 additions and 44 deletions

View File

@@ -1,18 +0,0 @@
FROM mcr.microsoft.com/devcontainers/base:dev-ubuntu-20.04
# 安装 build-essential 和调试工具
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
gdb \ # 添加GDB调试器
gcc \
make && \
# 清理 apt 缓存
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /workspace
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 update && sudo apt-get install -y gdb && make",
"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 # 任何命令失败都停止执行