From a933a35bcdd9f2af4f17163cbb3a187509d1d245 Mon Sep 17 00:00:00 2001 From: xuthus Date: Mon, 15 Apr 2024 22:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95CI/CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 10 ++++------ dockerfile | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 dockerfile diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 87054f5..fa3ee65 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,4 +1,4 @@ -name: pigallery2 +name: wx_post run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: [push] @@ -6,7 +6,7 @@ on: [push] jobs: # 作业1名称 - pigallery2-Gitea-Actions: + wx_post-Gitea-Actions: # 指定的运行器环境 runs-on: ubuntu-latest @@ -18,8 +18,6 @@ jobs: with: java-version: '8' distribution: 'adopt' - cache: 'maven' - cache-dependency-path: '**/pom.xml' # maven缓存,不加的话每次都会去重新拉取,会影响速度 - name: Dependies Cache uses: actions/cache@v2 @@ -41,9 +39,9 @@ jobs: uses: docker/build-push-action@v2 with: context: ./ - file: ./Dockerfile.build + file: ./dockerfile push: true - tags: k2.xuthus83.cn:6001/pigallery2:latest + tags: k2.xuthus83.cn:6001/wx_post:latest # - name: Build the Docker image # run: # | # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/MrGaoGang?tab=packages 查看 diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..121a5de --- /dev/null +++ b/dockerfile @@ -0,0 +1,14 @@ +#penjdk:8-jre 为基础镜像,来构建此镜像,可以理解为运行的需要基础环境 +FROM openjdk:8-jre +#WORKDIR指令用于指定容器的一个目录, 容器启动时执行的命令会在该目录下执行。 +WORKDIR /opt/docker/images/metabase/ +#将当前metabase.jar 复制到容器根目录下 +ADD metabase.jar metabase.jar +#将依赖包 复制到容器根目录/libs下,metabase.jar已不再需要添加其它jar包 +#ADD libs /libs +#暴露容器端口为3000 Docker镜像告知Docker宿主机应用监听了3000端口 +EXPOSE 3000 +#容器启动时执行的命令 +CMD java -jar metabase.jar + +//docker build // . 表示当前目录 -f 参数指定Dockerfile文件 -t 表示 制作的镜像:tag docker build -f DockerFile -t test/metabase:1.0.0 .