开发容器配置-初版

This commit is contained in:
2026-02-14 22:23:31 +08:00
parent d73b4795c1
commit 41ad420c72
10 changed files with 368 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
FROM ubuntu:noble
RUN if id "ubuntu" &>/dev/null; then \
echo "Deleting user 'ubuntu' for noble" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user for noble"; \
else \
echo "User 'ubuntu' does not exist for noble"; \
fi
ENV LANG="C.UTF-8"
#Merging the mutiple layers to reduce the size of the image slightly
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Restore man command
&& yes | unminimize 2>&1 \
# Install basic build tools
&& apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
make \
unzip \
# The tools in this package are used when installing packages for Python
build-essential \
swig3.0 \
# Required for Microsoft SQL Server
unixodbc-dev \
# Required for PostgreSQL
libpq-dev \
# Required for mysqlclient
default-libmysqlclient-dev \
# Required for ts
moreutils \
rsync \
zip \
libgdiplus \
jq \
# By default pip is not available in the buildpacks image
python3-pip \
#.NET Core related pre-requisites
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libncurses6 \
liblttng-ust1 \
libssl-dev \
libstdc++6 \
zlib1g \
libuuid1 \
libunwind8 \
sqlite3 \
libsqlite3-dev \
software-properties-common \
tk-dev \
uuid-dev \
curl \
gettext \
inotify-tools \
&& rm -rf /var/lib/apt/lists/* \
# This is the folder containing 'links' to benv and build script generator
&& apt-get update \
&& apt-get upgrade -y \
&& add-apt-repository universe \
&& rm -rf /var/lib/apt/lists/* \
# Verify expected build and debug tools are present
&& apt-get update \
&& apt-get -y install build-essential cmake cppcheck valgrind clang lldb llvm gdb python3-dev \
# Install tools and shells not in common script
&& apt-get install -yq vim vim-doc xtail software-properties-common libsecret-1-dev \
# Clean up
&& apt-get autoremove -y && apt-get clean -y \
# Move first run notice to right spot
&& mkdir -p "/usr/local/etc/vscode-dev-containers/" \
# Install and setup fish
&& apt-get install -yq fish \
&& FISH_PROMPT="function fish_prompt\n set_color green\n echo -n (whoami)\n set_color normal\n echo -n \":\"\n set_color blue\n echo -n (pwd)\n set_color normal\n echo -n \"> \"\nend\n" \
&& printf "$FISH_PROMPT" >> /etc/fish/functions/fish_prompt.fish \
&& printf "if type code-insiders > /dev/null 2>&1; and not type code > /dev/null 2>&1\n alias code=code-insiders\nend" >> /etc/fish/conf.d/code_alias.fish \
# Remove scripts now that we're done with them
&& apt-get clean -y && rm -rf /tmp/scripts
# Default to bash shell (other shells available at /usr/bin/fish and /usr/bin/zsh)
ENV SHELL=/bin/bash \
DOCKER_BUILDKIT=1
CMD [ "sleep", "infinity" ]

View File

@@ -0,0 +1,38 @@
{
"build": {
"dockerfile": "./Dockerfile",
"context": ".",
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "codespace",
"userUid": "1000",
"userGid": "1000",
"configureZshAsDefaultShell": true,
},
"ghcr.io/devcontainers/features/sshd:1": {
"gatewayPorts": "yes",
},
"ghcr.io/devcontainers/features/desktop-lite:1": {
"password": "noPassword",
},
},
"remoteUser": "codespace",
"containerUser": "codespace",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.executable": "/usr/bin/lldb",
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [],
},
},
}