diff --git a/Makefile b/Makefile index e1411364..95f2089b 100755 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/dev.Dockerfile b/dev.Dockerfile index fc842fd8..ff43a622 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -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"] \ No newline at end of file +CMD ["/app/run"] diff --git a/dev.compose.yml b/dev.compose.yml index 69e9bfd5..debd6b50 100644 --- a/dev.compose.yml +++ b/dev.compose.yml @@ -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