build: switch Docker images to Debian and optimize build process #19

Merged
hiifong merged 1 commits from docker into main 2025-04-06 14:45:31 +00:00
Member
  • Switch base image from golang:1.24-alpine to golang:1.24-bullseye for the build stage
  • Update working directory from /build to /app
  • Separate the copying of go.mod and go.sum files before downloading dependencies
  • Add comments for build stages and process steps
  • Switch final stage base image from ubuntu:24.04 to debian:bullseye-slim
  • Improve installation of ca-certificates and clean up the apt lists afterward
  • Create and switch to a non-root user named gitea-mcp
  • Change the file copy command to --chown=1000:1000 /app/gitea-mcp
  • Update CMD to use an absolute path /app/gitea-mcp

Signed-off-by: appleboy appleboy.tw@gmail.com

- Switch base image from `golang:1.24-alpine` to `golang:1.24-bullseye` for the build stage - Update working directory from `/build` to `/app` - Separate the copying of go.mod and go.sum files before downloading dependencies - Add comments for build stages and process steps - Switch final stage base image from `ubuntu:24.04` to `debian:bullseye-slim` - Improve installation of ca-certificates and clean up the apt lists afterward - Create and switch to a non-root user named `gitea-mcp` - Change the file copy command to `--chown=1000:1000 /app/gitea-mcp` - Update `CMD` to use an absolute path `/app/gitea-mcp` Signed-off-by: appleboy <appleboy.tw@gmail.com>
appleboy added 1 commit 2025-04-06 14:31:58 +00:00
build: switch Docker images to Debian and optimize build process
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 17s
check-and-test / Run govulncheck (pull_request) Successful in 15s
0e62ce1ee5
- Switch base image from `golang:1.24-alpine` to `golang:1.24-bullseye` for the build stage - Update working directory from `/build` to `/app` - Separate the copying of go.mod and go.sum files before downloading dependencies - Add comments for build stages and process steps - Switch final stage base image from `ubuntu:24.04` to `debian:bullseye-slim` - Improve installation of ca-certificates and clean up the apt lists afterward - Create and switch to a non-root user named `gitea-mcp` - Change the file copy command to `--chown=1000:1000 /app/gitea-mcp` - Update `CMD` to use an absolute path `/app/gitea-mcp` Signed-off-by: appleboy <appleboy.tw@gmail.com>
hiifong merged commit 02fd91da86 into main 2025-04-06 14:45:31 +00:00
hiifong deleted branch docker 2025-04-06 14:45:32 +00:00
Member

Why Separate the copying of go.mod and go.sum files before downloading dependencies is needed? 🤔

Why `Separate the copying of go.mod and go.sum files before downloading dependencies` is needed? 🤔

@yp05327 to help caching of docker build. the application code will change more often then gomod files will. so copy them in and download deps will be cached, then copy in application code and finish build.

@yp05327 to help caching of docker build. the application code will change more often then gomod files will. so copy them in and download deps will be cached, then copy in application code and finish build.
Member

@techknowlogick
Thanks for your explaination!

@techknowlogick Thanks for your explaination!

@yp05327 of course :) always happy to

@yp05327 of course :) always happy to
Sign in to join this conversation.
No description provided.