部署构建配置:.dockerignore / .gitignore(deploy) / Dockerfile 镜像分层
- 新增 .dockerignore,构建上下文减脂(排除 build/tests/.run/data/logs/rust/target 等) - .gitignore 排除 deploy/:种子数据含 API Key 与上游真 Key,只进镜像不入库 - Dockerfile 将 conf/nginx.conf、conf/tls/、www/、deploy/data-seed/ 拷入镜像 凭据与正式证书不进版本库,随镜像分发时勿推公共仓库
This commit is contained in:
1 parent
0b1d983cac
commit
eea0a15b9c
3 files changed
+24
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 构建上下文减脂:构建树、回归运行态、本地状态一律不进镜像
|
||||
build/
|
||||
tests/
|
||||
logs/
|
||||
data/
|
||||
.workbuddy/
|
||||
.git/
|
||||
.gitignore
|
||||
archive/
|
||||
*.md
|
||||
www/*.bak
|
||||
rust/target/
|
||||
**/.DS_Store
|
||||
**/*.log
|
||||
@@ -49,3 +49,6 @@ conf/tls/**/*.key
|
||||
conf/tls/**/*.cer
|
||||
conf/tls/**/*.crt
|
||||
conf/tls/**/*.pem
|
||||
|
||||
# 种子数据含 API Key 与上游真 Key,只进镜像不入库
|
||||
deploy/
|
||||
@@ -75,6 +75,13 @@ COPY --from=builder /src/nginx-${NGINX_VERSION}/objs/nginx /usr/local/nginx/sbin
|
||||
COPY --from=builder /src/nginx-${NGINX_VERSION}/conf/mime.types /usr/local/nginx/conf/mime.types
|
||||
COPY --from=builder /build/rust/target/release/libipass_gateway.so /usr/local/nginx/modules/
|
||||
|
||||
# 配置 / 证书(正式证书随镜像分发;勿把镜像推到公共仓库)/ 管理台静态页 / 种子数据
|
||||
# conf/nginx.conf 里的 include tls/*.conf 不递归,子目录内的供应商 .conf 不会被误加载
|
||||
COPY conf/nginx.conf /usr/local/nginx/conf/nginx.conf
|
||||
COPY conf/tls/ /usr/local/nginx/conf/tls/
|
||||
COPY www/ /usr/local/nginx/www/
|
||||
COPY deploy/data-seed/ /usr/local/nginx/data/
|
||||
|
||||
# 与旧版保持一致的工作目录约定,便于沿用现成的挂载与运维习惯
|
||||
RUN mkdir -p /usr/local/nginx/conf /usr/local/nginx/www /usr/local/nginx/data /usr/local/nginx/logs \
|
||||
&& ln -sf /dev/stdout /usr/local/nginx/logs/access.log \
|
||||
|
||||
Reference in new issue
Block a user