From 3f454b9805772d1cf42397476916ad36ad6b4098 Mon Sep 17 00:00:00 2001 From: enoch Date: Sat, 3 May 2025 14:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20init:=20java,=20rust,=20latext?= =?UTF-8?q?=20dev=20containers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java-container-dev-env/Containerfile | 12 +++++++++++ java-container-dev-env/compose.yaml | 19 +++++++++++++++++ latex-workspace-container/Containerfile | 3 +++ latex-workspace-container/compose.yaml | 27 +++++++++++++++++++++++++ rust-dev-env/Containerfile | 21 +++++++++++++++++++ rust-dev-env/compose.yaml | 9 +++++++++ 6 files changed, 91 insertions(+) create mode 100644 java-container-dev-env/Containerfile create mode 100644 java-container-dev-env/compose.yaml create mode 100644 latex-workspace-container/Containerfile create mode 100644 latex-workspace-container/compose.yaml create mode 100644 rust-dev-env/Containerfile create mode 100644 rust-dev-env/compose.yaml diff --git a/java-container-dev-env/Containerfile b/java-container-dev-env/Containerfile new file mode 100644 index 0000000..3173044 --- /dev/null +++ b/java-container-dev-env/Containerfile @@ -0,0 +1,12 @@ +FROM maven:3.9-eclipse-temurin-21 +# 安装基础工具 +RUN sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/ubuntu.sources && sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources && sed -i 's/http:/https:/g' /etc/apt/sources.list.d/ubuntu.sources +RUN apt-get update && \ + apt-get install -y git curl vim ripgrep unzip netcat-openbsd && \ + # 清理缓存 + rm -rf /var/lib/apt/lists/* +# 设置工作目录 +WORKDIR /workspace + +# 防止容器关闭 +CMD ["tail", "-f", "/dev/null"] diff --git a/java-container-dev-env/compose.yaml b/java-container-dev-env/compose.yaml new file mode 100644 index 0000000..b7e7ecb --- /dev/null +++ b/java-container-dev-env/compose.yaml @@ -0,0 +1,19 @@ +version: '3' + +services: + maven-dev-env: + image: maven-java21-dev:3.9 + build: + context: . + dockerfile: Containerfile + container_name: maven-dev-env + restart: unless-stopped + ports: + - "9090:9090" + volumes: + - /workspace/projects/:/projects + - /workspace:/workspace + - /workspace/container-root-volumes/maven-dev-env-root:/root + # stdin_open: true # For -i + # tty: true # For -t + # detach mode is default in compose diff --git a/latex-workspace-container/Containerfile b/latex-workspace-container/Containerfile new file mode 100644 index 0000000..5aa3f00 --- /dev/null +++ b/latex-workspace-container/Containerfile @@ -0,0 +1,3 @@ +# Dockerfile示例 +FROM texlive/texlive:latest +RUN apt-get update && apt-get install -y git wget openssh-client netcat-openbsd bash-completion vim && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/latex-workspace-container/compose.yaml b/latex-workspace-container/compose.yaml new file mode 100644 index 0000000..ea59d4e --- /dev/null +++ b/latex-workspace-container/compose.yaml @@ -0,0 +1,27 @@ +version: '3' + +services: + latex-workspace: + # image: texlive/texlive:latest + image: localhost/latex-env:v1 + build: + context: . + dockerfile: Containerfile + # image: localhost/latex-env:latest + container_name: latex-workspace + hostname: latex-env + volumes: + - /workspace/latex-projects:/workspace + - latex-root:/root + working_dir: /workspace + command: tail -f /dev/null # Keep the container running + environment: + - TERM=xterm-256color + restart: unless-stopped + ports: + - 8000:8000 + +volumes: + latex-root: + #latex-workspace: + diff --git a/rust-dev-env/Containerfile b/rust-dev-env/Containerfile new file mode 100644 index 0000000..31369e2 --- /dev/null +++ b/rust-dev-env/Containerfile @@ -0,0 +1,21 @@ +# 使用官方Rust镜像 +FROM rust:latest + +# 安装必要的系统依赖和工具 +RUN apt-get update && \ + apt-get install -y \ + build-essential \ + libssl-dev \ + pkg-config \ + git \ + vim \ + curl && \ + apt-get clean &&\ + rm -rf /var/lib/apt/lists/* + +# 配置工作目录 +#WORKDIR /app +WORKDIR /workspace +# 设置默认启动命令 +CMD ["bash"] + diff --git a/rust-dev-env/compose.yaml b/rust-dev-env/compose.yaml new file mode 100644 index 0000000..beabed5 --- /dev/null +++ b/rust-dev-env/compose.yaml @@ -0,0 +1,9 @@ +version: '3' +services: + rust-dev: + image: rust-dev + volumes: + - /workspace/projects:/workspace + working_dir: /workspace + tty: true + stdin_open: true