签入版本
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
# Docker 自身配置(不参与镜像构建)
|
||||
/docker
|
||||
/.jenkins
|
||||
|
||||
# 开发/文档资产,运行时不需要
|
||||
/document
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
masterProfiles: ['','uat','prod']
|
||||
Profiles: ['','dev']
|
||||
jobConfigFile: "easygoadminConfig.yml"
|
||||
npmCompileCMD: |
|
||||
export PATH=/usr/local/node/bin:$PATH
|
||||
set -e \
|
||||
&& yarn config set registry https://registry.npmmirror.com \
|
||||
&& yarn config get registry \
|
||||
&& yarn config set strict-ssl false \
|
||||
&& yarn config set sass_binary_site https://repo.huaweicloud.com/node-sass/node-sass \
|
||||
&& rm -rf package-lock.json \
|
||||
&& rm -rf node_modules/.cache 2>/dev/null || true \
|
||||
&& yarn cache clean --force \
|
||||
&& yarn global add node-gyp@10.3.1 \
|
||||
&& yarn install --unsafe-perm --legacy-peer-deps --network-timeout 300000 \
|
||||
&& yarn run build:${PROFILE}
|
||||
@@ -0,0 +1,62 @@
|
||||
# +======================================================================
|
||||
# | 模块: Jenkins 镜像构建文件
|
||||
# | 说明: CI 场景将已编译的 Go 二进制打包为应用镜像(编译在 Jenkins 侧完成,镜像内不编译)
|
||||
# | 构建上下文为项目根目录,由 Jenkins 流水线注入构建参数,例如:
|
||||
# | docker build -f .jenkins/Dockerfile \
|
||||
# | --build-arg VAR_BASE_IMAGE=alpine:3.22 \
|
||||
# | --build-arg VAR_GOFILE=admin-server \
|
||||
# | --build-arg VAR_GOFILE_PATH=bin/admin-server \
|
||||
# | --build-arg VAR_PORT=8000 \
|
||||
# | -t easygoadmin:$TAG .
|
||||
# +======================================================================
|
||||
|
||||
# 基础镜像地址(如 alpine:3.22,可指向公司私服预置镜像)
|
||||
ARG VAR_BASE_IMAGE
|
||||
|
||||
# 基础镜像
|
||||
FROM ${VAR_BASE_IMAGE}
|
||||
# 镜像作者
|
||||
LABEL MAINTAINER="easygoadmin@163.com"
|
||||
|
||||
# 端口参数(后端监听端口,与 manifest/config/config.yaml 的 server.address 一致)
|
||||
ARG VAR_PORT
|
||||
# 二进制文件名参数(不含路径,如 admin-server)
|
||||
ARG VAR_GOFILE
|
||||
# 二进制文件路径参数(Jenkins 编译产物在构建上下文中的相对路径,如 bin/admin-server)
|
||||
ARG VAR_GOFILE_PATH
|
||||
|
||||
# 设置端口
|
||||
ENV PORT=${VAR_PORT}
|
||||
# 设置二进制文件名
|
||||
ENV GOFILE=${VAR_GOFILE}
|
||||
# 设置时区(日志落盘与 gcron 定时任务依赖系统时区)
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE ${PORT}
|
||||
|
||||
# 创建工作区
|
||||
RUN mkdir -p /opt/apps
|
||||
# 设置工作区
|
||||
WORKDIR /opt/apps
|
||||
|
||||
# 拷贝运行时资产(四件缺一不可,路径相对项目根)
|
||||
# manifest/config 运行时配置(敏感项运行时经 GF_GENV_ 环境变量覆盖,不改镜像内文件)
|
||||
# manifest/data ip2region.xdb 归属地库
|
||||
# resource 验证码字体、swagger 页面等静态资源
|
||||
# templates 代码生成器模板(tool 域运行时读取)
|
||||
COPY manifest ./manifest
|
||||
COPY resource ./resource
|
||||
COPY templates ./templates
|
||||
|
||||
# 拷贝 Jenkins 编译产物(Go 静态编译 CGO_ENABLED=0,直接可执行)
|
||||
# 编译建议:CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o bin/admin-server main.go
|
||||
COPY ${VAR_GOFILE_PATH} ./
|
||||
|
||||
# 启动命令
|
||||
# ${GOFILE} 为编译产物文件名,如 admin-server
|
||||
# 配置覆盖示例(Jenkins 部署阶段注入,勿写死镜像):
|
||||
# -e GF_GENV_DATABASE_DEFAULT_LINK="mysql:...@tcp(host:3306)/easygoadmin.goframe.elevue?..."
|
||||
# -e GF_GENV_REDIS_DEFAULT_ADDRESS="host:6379"
|
||||
# -e GF_GENV_FILE_UPLOADDIR="/data/upload" # 容器内必须覆盖(配置默认为开发机绝对路径)
|
||||
CMD ["sh", "-c", "./${GOFILE}"]
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
@Library('share-library@master')_
|
||||
orgName = 'easygoadmin'
|
||||
pipelineGolangService(orgName)
|
||||
Reference in New Issue
Block a user