Improve build system and Docker configuration
- Switch Dockerfile base image from golang:1.23-bookworm to debian:12-slim - Update Dockerfile to use pre-built binary instead of building in container - Fix Docker CMD to use new CLI flag format with --listen and --root-path - Update Makefile to build binary to ./dist/ directory with CGO_ENABLED=0 - Make build-docker target depend on build target for efficiency - Change clean target to remove ./dist directory instead of single binary
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.23-bookworm
|
||||
FROM debian:12-slim
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
@@ -9,7 +9,8 @@ COPY ./gemserve /app/gemserve
|
||||
WORKDIR /app
|
||||
|
||||
RUN chmod +x /app/gemserve && \
|
||||
chown -R user:user /app
|
||||
chown -R root:root /app && \
|
||||
chmod -R 755 /app
|
||||
|
||||
USER user
|
||||
CMD ["/app/gemserve","0.0.0.0:1965"]
|
||||
CMD ["/app/gemserve","--listen","0.0.0.0:1965","--root-path","/srv"]
|
||||
|
||||
7
Makefile
7
Makefile
@@ -4,7 +4,7 @@ export PATH := $(PATH)
|
||||
all: fmt lintfix tidy test clean build
|
||||
|
||||
clean:
|
||||
rm -f ./gemserve
|
||||
rm -rf ./dist
|
||||
|
||||
debug:
|
||||
@echo "PATH: $(PATH)"
|
||||
@@ -35,9 +35,10 @@ lintfix: fmt
|
||||
golangci-lint run --fix
|
||||
|
||||
build:
|
||||
go build -o ./gemserve ./main.go
|
||||
mkdir -p ./dist
|
||||
CGO_ENABLED=0 go build -o ./dist/gemserve ./main.go
|
||||
|
||||
build-docker:
|
||||
build-docker: build
|
||||
docker build -t gemserve .
|
||||
|
||||
show-updates:
|
||||
|
||||
Reference in New Issue
Block a user