mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
chore: simplify dev docker and update Makefile accordingly
This commit is contained in:
9
Makefile
9
Makefile
@@ -34,7 +34,7 @@ else ifeq ($(debug), 1)
|
|||||||
GODOXY_DEBUG = 1
|
GODOXY_DEBUG = 1
|
||||||
BUILD_FLAGS += -gcflags=all='-N -l' -tags debug -asan
|
BUILD_FLAGS += -gcflags=all='-N -l' -tags debug -asan
|
||||||
else ifeq ($(pprof), 1)
|
else ifeq ($(pprof), 1)
|
||||||
CGO_ENABLED = 1
|
CGO_ENABLED = 0
|
||||||
GORACE = log_path=logs/pprof strip_path_prefix=$(shell pwd)/ halt_on_error=1
|
GORACE = log_path=logs/pprof strip_path_prefix=$(shell pwd)/ halt_on_error=1
|
||||||
BUILD_FLAGS += -tags pprof
|
BUILD_FLAGS += -tags pprof
|
||||||
VERSION := ${VERSION}-pprof
|
VERSION := ${VERSION}-pprof
|
||||||
@@ -113,13 +113,10 @@ run:
|
|||||||
cd ${PWD} && [ -f .env ] && godotenv -f .env go run ${BUILD_FLAGS} ./cmd
|
cd ${PWD} && [ -f .env ] && godotenv -f .env go run ${BUILD_FLAGS} ./cmd
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
docker compose -f dev.compose.yml up -t 0 -d
|
docker compose -f dev.compose.yml $(args)
|
||||||
|
|
||||||
dev-build: build
|
dev-build: build
|
||||||
docker compose -f dev.compose.yml up -t 0 -d
|
docker compose -f dev.compose.yml up -t 0 -d app --force-recreate
|
||||||
|
|
||||||
dev-logs:
|
|
||||||
docker compose -f dev.compose.yml logs -f app
|
|
||||||
|
|
||||||
dev-run: build
|
dev-run: build
|
||||||
cd dev-data && ${BIN_PATH}
|
cd dev-data && ${BIN_PATH}
|
||||||
|
|||||||
@@ -1,27 +1,7 @@
|
|||||||
# Stage 1: deps
|
FROM alpine:3.22
|
||||||
FROM alpine:3.22 AS deps
|
|
||||||
HEALTHCHECK NONE
|
|
||||||
|
|
||||||
# package version does not matter
|
RUN apk add --no-cache ca-certificates
|
||||||
# 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
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN chown -R 1000:1000 /app
|
CMD ["/app/run"]
|
||||||
|
|
||||||
CMD ["/app/run"]
|
|
||||||
|
|||||||
@@ -4,12 +4,11 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: dev.Dockerfile
|
dockerfile: dev.Dockerfile
|
||||||
args:
|
|
||||||
- TARGET=godoxy
|
|
||||||
container_name: godoxy-proxy-dev
|
container_name: godoxy-proxy-dev
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: dev.env
|
env_file: dev.env
|
||||||
environment:
|
environment:
|
||||||
|
DOCKER_HOST: unix:///var/run/docker.sock
|
||||||
TZ: Asia/Hong_Kong
|
TZ: Asia/Hong_Kong
|
||||||
API_ADDR: 127.0.0.1:8999
|
API_ADDR: 127.0.0.1:8999
|
||||||
API_USER: dev
|
API_USER: dev
|
||||||
@@ -24,6 +23,7 @@ services:
|
|||||||
ipc: host
|
ipc: host
|
||||||
network_mode: host
|
network_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./bin/godoxy:/app/run:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./dev-data/config:/app/config
|
- ./dev-data/config:/app/config
|
||||||
- ./dev-data/certs:/app/certs
|
- ./dev-data/certs:/app/certs
|
||||||
|
|||||||
Reference in New Issue
Block a user