chore: simplify dev docker and update Makefile accordingly

This commit is contained in:
yusing
2025-10-10 23:24:14 +08:00
parent b23c3f1c3b
commit c4c9e9300c
3 changed files with 8 additions and 31 deletions

View File

@@ -34,7 +34,7 @@ else ifeq ($(debug), 1)
GODOXY_DEBUG = 1
BUILD_FLAGS += -gcflags=all='-N -l' -tags debug -asan
else ifeq ($(pprof), 1)
CGO_ENABLED = 1
CGO_ENABLED = 0
GORACE = log_path=logs/pprof strip_path_prefix=$(shell pwd)/ halt_on_error=1
BUILD_FLAGS += -tags pprof
VERSION := ${VERSION}-pprof
@@ -113,13 +113,10 @@ run:
cd ${PWD} && [ -f .env ] && godotenv -f .env go run ${BUILD_FLAGS} ./cmd
dev:
docker compose -f dev.compose.yml up -t 0 -d
docker compose -f dev.compose.yml $(args)
dev-build: build
docker compose -f dev.compose.yml up -t 0 -d
dev-logs:
docker compose -f dev.compose.yml logs -f app
docker compose -f dev.compose.yml up -t 0 -d app --force-recreate
dev-run: build
cd dev-data && ${BIN_PATH}

View File

@@ -1,27 +1,7 @@
# Stage 1: deps
FROM alpine:3.22 AS deps
HEALTHCHECK NONE
FROM alpine:3.22
# package version does not matter
# trunk-ignore(hadolint/DL3018)
RUN apk add --no-cache tzdata
# Stage 2: Final image
FROM deps
LABEL maintainer="yusing@6uo.me"
LABEL proxy.exclude=1
ARG TARGET
ENV TARGET=${TARGET}
ENV DOCKER_HOST=unix:///var/run/docker.sock
# copy binary
COPY bin/${TARGET} /app/run
RUN apk add --no-cache ca-certificates
WORKDIR /app
RUN chown -R 1000:1000 /app
CMD ["/app/run"]
CMD ["/app/run"]

View File

@@ -4,12 +4,11 @@ services:
build:
context: .
dockerfile: dev.Dockerfile
args:
- TARGET=godoxy
container_name: godoxy-proxy-dev
restart: unless-stopped
env_file: dev.env
environment:
DOCKER_HOST: unix:///var/run/docker.sock
TZ: Asia/Hong_Kong
API_ADDR: 127.0.0.1:8999
API_USER: dev
@@ -24,6 +23,7 @@ services:
ipc: host
network_mode: host
volumes:
- ./bin/godoxy:/app/run:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./dev-data/config:/app/config
- ./dev-data/certs:/app/certs