refactor: 目录重构为 top/image(自建镜像)与 top/app(部署编排)

This commit is contained in:
2025-10-11 21:45:40 +08:00
parent f17b8677b1
commit 16abb6fc2e
242 changed files with 125 additions and 25 deletions
@@ -0,0 +1,8 @@
#FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:220901.1
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:3.13.3
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
WORKDIR /home/admin
# 升级会有很多问题,比如nginx编译失败等
#RUN yum update -y && yum clean all;
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.427-linux-x64-binaries
ADD https://download.visualstudio.microsoft.com/download/pr/12ee34e8-640c-400e-a6dc-4892b442df92/81d40fc98a5bbbfbafa4cc1ab86d6288/dotnet-sdk-6.0.427-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf dotnet-sdk-6.0.427-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet6
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
@@ -0,0 +1,4 @@
bin/
obj/
.git/
.DS_Store
@@ -0,0 +1,2 @@
bin/
obj/
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>Demo</RootNamespace>
</PropertyGroup>
</Project>
+18
View File
@@ -0,0 +1,18 @@
# 编译阶段:使用编译环境镜像 compile-dotnet6(含 SDK 6.0.427)
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet6 AS build
WORKDIR /src
COPY Demo.csproj ./
RUN dotnet restore Demo.csproj
COPY . ./
RUN dotnet publish Demo.csproj -c Release -o /app/publish --no-restore
# 运行阶段:使用运行环境镜像 runtime-dotnet6(仅含 ASP.NET Core 运行时 6.0.35)
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-dotnet6 AS runtime
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV ASPNETCORE_URLS=http://0.0.0.0:8080
ENV DOTNET_RUNNING_IN_CONTAINER=true
WORKDIR /home/admin
COPY --from=build /app/publish ./
EXPOSE 8080
ENTRYPOINT ["dotnet", "Demo.dll"]
+18
View File
@@ -0,0 +1,18 @@
var builder = WebApplication.CreateBuilder(args);
// 容器内监听 8080,避免与宿主机其它 80 端口冲突;可用环境变量 ASPNETCORE_URLS 覆盖
builder.WebHost.UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://0.0.0.0:8080");
var app = builder.Build();
app.MapGet("/", () => Results.Json(new
{
message = "dotnet6 is running",
runtime = Environment.Version.ToString(),
os = System.Runtime.InteropServices.RuntimeInformation.OSDescription,
time = DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss zzz")
}));
app.MapGet("/health", () => Results.Ok("ok"));
app.Run();
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# 在示例目录下构建示例镜像(编译 + 运行两阶段均在本机 docker 内完成)
set -euo pipefail
cd "$(dirname "$0")"
IMAGE=${IMAGE:-registry.cn-shanghai.aliyuncs.com/odboy/kenaito:demo-dotnet6}
docker build -t "${IMAGE}" .
if [ "${PUSH:-0}" = "1" ]; then
docker push "${IMAGE}"
fi
@@ -0,0 +1,28 @@
version: '3.8'
networks:
dotnet6-demo:
ipam:
driver: default
config:
- subnet: "172.26.0.0/24"
services:
demo:
image: registry.cn-shanghai.aliyuncs.com/odboy/kenaito:demo-dotnet6 # 镜像由 build.sh 构建
container_name: dotnet6-demo
restart: unless-stopped
ports: # 映射端口
- "8080:8080"
environment: # 设置环境变量,相当于docker run命令中的-e
TZ: Asia/Shanghai
ASPNETCORE_URLS: http://0.0.0.0:8080
healthcheck:
test: ["CMD-SHELL", "netstat -tln | grep -q ':8080 '"]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
networks:
dotnet6-demo:
ipv4_address: 172.26.0.20
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
docker-compose -f docker-compose.yml -p dotnet6-demo up -d
+78
View File
@@ -0,0 +1,78 @@
# dotnet6 编译 + 运行示例
演示如何用本目录的两个镜像构建一个 .NET 6 Web 应用:
| 阶段 | 镜像 | 说明 |
|----|-------------------------------------------------------------|-----------------------------|
| 编译 | `registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet6` | 含 SDK 6.0.427(见上级 `Dockerfile`) |
| 运行 | `registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-dotnet6` | 仅含 ASP.NET Core 运行时 6.0.35(见 `top/image/runtime-dotnet6`) |
编译环境镜像带 SDK 和整套编译工具链(体积大),只在构建阶段使用;运行阶段只拷贝 `dotnet publish` 的产物,
镜像里不带 SDK、源码和中间文件。
### 示例内容
```
demo/
├── Demo.csproj # net6.0 Web 项目
├── Program.cs # 最小 Web API:GET / 返回运行时信息,GET /health 健康检查
├── Dockerfile # 两阶段构建:compile-dotnet6 -> runtime-dotnet6
├── build.sh # 构建镜像(PUSH=1 时同时推送)
├── docker-compose.yml # 部署编排(端口 8080,固定 IP 172.26.0.20)
├── install.sh # docker-compose up -d
└── shutdown.sh # docker-compose down
```
### 构建与部署
```shell
sh build.sh # docker build -t registry.cn-shanghai.aliyuncs.com/odboy/kenaito:demo-dotnet6 .
PUSH=1 sh build.sh # 构建并推送
sh install.sh # docker-compose -f docker-compose.yml -p dotnet6-demo up -d
```
访问:
```shell
curl http://192.168.235.104:8080/ # {"message":"dotnet6 is running","runtime":"6.0.35",...}
curl http://192.168.235.104:8080/health # ok
```
### 关键点
**还原与发布分离**:先 `COPY` 只有 `*.csproj` 的一层执行 `dotnet restore`,再 `COPY` 源码 `dotnet publish --no-restore`。
源码改动不会让还原缓存失效,重复构建更快。多项目解决方案可按需增加 `COPY` 的 `*.sln` / `*.csproj` 文件。
**监听地址**:容器内监听 `8080`(`ASPNETCORE_URLS=http://0.0.0.0:8080`),不占用 80 端口,方便与宿主机其它服务共存。
镜像环境变量、compose 环境变量、部署时 `-e` 三者依次覆盖。
**时区**:镜像已内置 `TimeZone=Asia/Shanghai`,`DateTimeOffset.Now` 输出 +08:00;compose 中再用 `TZ` 显式声明一次。
**入口**:`ENTRYPOINT ["dotnet", "Demo.dll"]`,使用 exec 形式保证 `docker stop` 的 SIGTERM 能传到进程,优雅退出。
**健康检查**:运行镜像自带 `netstat`(`net-tools`),直接用端口探测,不需要额外安装 curl。
### 运维命令
```shell
docker logs -f dotnet6-demo # 应用日志(stdout/stderr)
docker exec dotnet6-demo dotnet --info # 确认运行时版本
docker exec dotnet6-demo sh -c 'ls /home/admin'
```
### 调试时直接在编译镜像里运行
需要看编译报错或临时跑一下时,可以只挂载源码进编译镜像(不需要构建镜像):
```shell
docker run --rm -it -p 8080:8080 \
-v "$PWD":/src -w /src \
registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet6 \
dotnet run
```
### 停止
```shell
sh shutdown.sh
```
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
docker-compose -f docker-compose.yml -p dotnet6-demo down
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-8.0.403-linux-x64-binaries
ADD https://download.visualstudio.microsoft.com/download/pr/ca6cd525-677e-4d3a-b66c-11348a6f920a/ec395f498f89d0ca4d67d903892af82d/dotnet-sdk-8.0.403-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf dotnet-sdk-8.0.403-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet8
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-9.0.100-rc.2-linux-x64-binaries
ADD https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.100-rc.2.24474.11/dotnet-sdk-9.0.100-rc.2.24474.11-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf dotnet-sdk-9.0.100-rc.2.24474.11-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:compile-dotnet9
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+56
View File
@@ -0,0 +1,56 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV TENGINE_VERSION=3.1.0
ENV NGINX_HOME=/usr/local/nginx
ENV PATH="${NGINX_HOME}/sbin:$PATH"
WORKDIR /home/admin
# 使用自定义配置覆盖默认可映射的目录:conf/nginx.conf、conf/conf.d、conf/ssl
COPY nginx.conf ${NGINX_HOME}/conf/nginx.conf
# https://tengine.taobao.org/download/tengine-3.1.0.tar.gz
ADD https://tengine.taobao.org/download/tengine-${TENGINE_VERSION}.tar.gz ./
RUN yum install \
gcc \
gcc-c++ \
make \
tar \
pcre-devel \
zlib-devel \
openssl-devel \
libxml2-devel \
libxslt-devel \
gd-devel \
geoip-devel \
sysstat \
net-tools -y; \
tar -xzvf tengine-${TENGINE_VERSION}.tar.gz; \
cd tengine-${TENGINE_VERSION}; \
./configure \
--prefix=${NGINX_HOME} \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_geoip_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-pcre-jit; \
make; \
make install; \
mkdir -p ${NGINX_HOME}/conf/ssl ${NGINX_HOME}/conf/conf.d; \
ls -l ${NGINX_HOME}/sbin; \
${NGINX_HOME}/sbin/nginx -t -c ${NGINX_HOME}/conf/nginx.conf; \
rm -rf /home/admin/tengine-${TENGINE_VERSION} /home/admin/tengine-${TENGINE_VERSION}.tar.gz
# tengine 默认以 nobody 用户运行 worker 进程,root 启动后自动降权,可直接监听 80/443
EXPOSE 80 443
STOPSIGNAL SIGQUIT
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:proxy-tengine3
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+63
View File
@@ -0,0 +1,63 @@
user root;
# 按 CPU 核数设置,超过 8 个收益很小;需要时可直接改成具体数字,如 4
worker_processes auto;
# 每个 worker 打开的文件描述符上限,为高并发场景预留
worker_rlimit_nofile 65535;
# 错误日志级别 warn,避免大量冗余 info 日志;容器内输出到 stderr 方便收集
error_log stderr warn;
events {
# 高并发场景用 epoll;worker_connections 与 worker_processes 相乘即最大并发连接数
use epoll;
worker_connections 10240;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '"$http_x_forwarded_for" $remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$upstream_addr"';
# 容器环境下日志输出到 stdout/stderr,交给 docker 日志驱动统一处理
access_log /dev/stdout main;
# 只为低版本浏览器不支持的格式做 gzip,现代浏览器直接用 gzip_static 提供的 .gz 文件
gzip on;
gzip_vary on;
gzip_comp_level 5;
gzip_min_length 1k;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/json application/javascript
application/rss+xml application/atom+xml image/svg+xml;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
# 客户端请求头/请求体超时,防止慢连接长期占用 worker
client_header_timeout 15s;
client_body_timeout 15s;
send_timeout 15s;
# 调优: 32的倍数
server_names_hash_max_size 1024;
server_names_hash_bucket_size 128;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
client_max_body_size 1200m;
# 大文件上传时先把请求体落到磁盘,避免占用内存
client_body_buffer_size 128k;
# 文件缓存,减少磁盘 stat 次数;大小可视容器内打开文件数调整
open_file_cache max=10000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /usr/local/nginx/conf/conf.d/*.conf;
}
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-6.0.35-linux-x64-binaries
ADD https://download.visualstudio.microsoft.com/download/pr/ccdb3628-8f55-411b-b0f1-669d42604ad8/81283ab8762aaab1be72772711f07f86/aspnetcore-runtime-6.0.35-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf aspnetcore-runtime-6.0.35-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-dotnet6
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-8.0.10-linux-x64-binaries
ADD https://download.visualstudio.microsoft.com/download/pr/6d143cf6-e215-428e-bcde-9fd50ea0e1be/99652e31b3e0161a3f1f933e0bedf223/aspnetcore-runtime-8.0.10-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf aspnetcore-runtime-8.0.10-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-dotnet8
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+29
View File
@@ -0,0 +1,29 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV DOTNET_HOME=/usr/local/dotnet
ENV PATH="${DOTNET_HOME}:$PATH"
WORKDIR /home/admin
# https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-9.0.0-rc.2-linux-x64-binaries
ADD https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/9.0.0-rc.2.24474.3/aspnetcore-runtime-9.0.0-rc.2.24474.3-linux-x64.tar.gz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
mkdir /usr/local/dotnet; \
tar -xzvf aspnetcore-runtime-9.0.0-rc.2.24474.3-linux-x64.tar.gz -C /usr/local/dotnet; \
dotnet --info;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-dotnet9
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+15
View File
@@ -0,0 +1,15 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV JAVA_HOME=/usr/local/java
ENV PATH="${JAVA_HOME}/bin:$PATH"
WORKDIR /home/admin
ADD jdk-11.0.2.tar.gz ./
RUN yum install \
tar \
wget \
net-tools \
bind-utils -y; \
mv ./jdk-11.0.2 ${JAVA_HOME}; \
chmod +x ${JAVA_HOME}/bin/*; \
java -version;
+9
View File
@@ -0,0 +1,9 @@
curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
tar -xzvf openjdk-11.0.2_linux-x64_bin.tar.gz
rm -f openjdk-11.0.2_linux-x64_bin.tar.gz
rm -f jdk-11.0.2/lib/src.zip
tar -czvf jdk-11.0.2.tar.gz jdk-11.0.2
rm -rf jdk-11.0.2
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-jdk11
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+15
View File
@@ -0,0 +1,15 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV JAVA_HOME=/usr/local/java
ENV PATH="${JAVA_HOME}/bin:$PATH"
WORKDIR /home/admin
ADD jdk-17.0.2.tar.gz ./
RUN yum install \
tar \
wget \
net-tools \
bind-utils -y; \
mv ./jdk-17.0.2 ${JAVA_HOME}; \
chmod +x ${JAVA_HOME}/bin/*; \
java -version;
+9
View File
@@ -0,0 +1,9 @@
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar -xzvf openjdk-17.0.2_linux-x64_bin.tar.gz
rm -f openjdk-17.0.2_linux-x64_bin.tar.gz
rm -f jdk-17.0.2/lib/src.zip
tar -czvf jdk-17.0.2.tar.gz jdk-17.0.2
rm -rf jdk-17.0.2
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-jdk17
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+15
View File
@@ -0,0 +1,15 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV JAVA_HOME=/usr/local/java
ENV PATH="${JAVA_HOME}/bin:$PATH"
WORKDIR /home/admin
ADD jdk-21.0.2.tar.gz ./
RUN yum install \
tar \
wget \
net-tools \
bind-utils -y; \
mv ./jdk-21.0.2 ${JAVA_HOME}; \
chmod +x ${JAVA_HOME}/bin/*; \
java -version;
+9
View File
@@ -0,0 +1,9 @@
curl -O https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz
tar -xzvf openjdk-21.0.2_linux-x64_bin.tar.gz
rm -f openjdk-21.0.2_linux-x64_bin.tar.gz
rm -f jdk-21.0.2/lib/src.zip
tar -czvf jdk-21.0.2.tar.gz jdk-21.0.2
rm -rf jdk-21.0.2
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-jdk21
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+32
View File
@@ -0,0 +1,32 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV PYTHON_HOME=/usr/local/python3
ENV PATH="${PYTHON_HOME}/bin:$PATH"
WORKDIR /home/admin
ADD https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
tar -xvf Python-3.10.0.tgz; \
cd Python-3.10.0; \
./configure --prefix=/usr/local/python3; \
make && make install; \
python3 -V; \
mkdir ~/.pip;
COPY pip.conf ~/.pip/
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:runtime-python3
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+5
View File
@@ -0,0 +1,5 @@
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
[install]
trusted-host = mirrors.aliyun.com
+35
View File
@@ -0,0 +1,35 @@
FROM registry.cn-shanghai.aliyuncs.com/odboy/kenaito:alinux3-update20261111
LABEL MAINTAINER="tianjun@odboy.cn"
ENV TimeZone=Asia/Shanghai
ENV PYTHON_HOME=/usr/local/python3
ENV PATH="${PYTHON_HOME}/bin:$PATH"
WORKDIR /home/admin
ADD https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz ./
RUN yum install \
libffi-devel \
zlib-devel \
bzip2-devel \
openssl-devel \
ncurses-devel \
sqlite-devel \
readline-devel \
tk-devel \
gdbm-devel \
libpcap-devel \
xz-devel \
make \
patch \
gcc \
tar \
sysstat \
net-tools -y; \
tar -xvf Python-3.10.0.tgz; \
cd Python-3.10.0; \
./configure --prefix=/usr/local/python3; \
make && make install; \
python3 -V; \
mkdir ~/.pip;
COPY pip.conf ~/.pip/
RUN yum install -y \
epel-release \
ansible;
+3
View File
@@ -0,0 +1,3 @@
IMAGE=registry.cn-shanghai.aliyuncs.com/odboy/kenaito:tools-ansible
docker build -t "${IMAGE}" .
docker push "${IMAGE}"
+5
View File
@@ -0,0 +1,5 @@
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
[install]
trusted-host = mirrors.aliyun.com