mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 10:18:59 +02:00
feat(docker): add development Docker setup with dev.compose.yml and Dockerfile
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,4 +38,5 @@ node_modules/
|
|||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
|
|
||||||
!agent.compose.yml
|
!agent.compose.yml
|
||||||
|
!dev.compose.yml
|
||||||
!agent/pkg/**
|
!agent/pkg/**
|
||||||
|
|||||||
9
Makefile
9
Makefile
@@ -2,6 +2,7 @@ shell := /bin/sh
|
|||||||
export VERSION ?= $(shell git describe --tags --abbrev=0)
|
export VERSION ?= $(shell git describe --tags --abbrev=0)
|
||||||
export BUILD_DATE ?= $(shell date -u +'%Y%m%d-%H%M')
|
export BUILD_DATE ?= $(shell date -u +'%Y%m%d-%H%M')
|
||||||
export GOOS = linux
|
export GOOS = linux
|
||||||
|
export GOARCH ?= amd64
|
||||||
|
|
||||||
WEBUI_DIR ?= ../godoxy-frontend
|
WEBUI_DIR ?= ../godoxy-frontend
|
||||||
DOCS_DIR ?= ../godoxy-wiki
|
DOCS_DIR ?= ../godoxy-wiki
|
||||||
@@ -113,9 +114,11 @@ build:
|
|||||||
run:
|
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
|
||||||
|
|
||||||
debug:
|
dev:
|
||||||
make NAME="godoxy-test" debug=1 build
|
docker compose -f dev.compose.yml up -t 0 -d
|
||||||
sh -c 'HTTP_ADDR=:81 HTTPS_ADDR=:8443 API_ADDR=:8899 DEBUG=1 bin/godoxy-test'
|
|
||||||
|
dev-build: build
|
||||||
|
docker compose -f dev.compose.yml up -t 0 -d --build
|
||||||
|
|
||||||
mtrace:
|
mtrace:
|
||||||
${BIN_PATH} debug-ls-mtrace > mtrace.json
|
${BIN_PATH} debug-ls-mtrace > mtrace.json
|
||||||
|
|||||||
33
dev.Dockerfile
Normal file
33
dev.Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Stage 1: deps
|
||||||
|
FROM golang:1.25.0-alpine AS deps
|
||||||
|
HEALTHCHECK NONE
|
||||||
|
|
||||||
|
# package version does not matter
|
||||||
|
# trunk-ignore(hadolint/DL3018)
|
||||||
|
RUN apk add --no-cache tzdata make libcap-setcap
|
||||||
|
|
||||||
|
# Stage 3: Final image
|
||||||
|
FROM alpine:3.22
|
||||||
|
|
||||||
|
LABEL maintainer="yusing@6uo.me"
|
||||||
|
LABEL proxy.exclude=1
|
||||||
|
|
||||||
|
# copy timezone data
|
||||||
|
COPY --from=deps /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
|
||||||
|
# copy certs
|
||||||
|
COPY --from=deps /etc/ssl/certs /etc/ssl/certs
|
||||||
|
|
||||||
|
ARG TARGET
|
||||||
|
ENV TARGET=${TARGET}
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
# copy binary
|
||||||
|
COPY bin/${TARGET} /app/run
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN chown -R 1000:1000 /app
|
||||||
|
|
||||||
|
CMD ["/app/run"]
|
||||||
60
dev.compose.yml
Normal file
60
dev.compose.yml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
services:
|
||||||
|
socket-proxy:
|
||||||
|
container_name: socket-proxy-dev
|
||||||
|
image: ghcr.io/yusing/socket-proxy:latest
|
||||||
|
environment:
|
||||||
|
- CONTAINERS=1
|
||||||
|
- EVENTS=1
|
||||||
|
- INFO=1
|
||||||
|
- PING=1
|
||||||
|
- POST=0
|
||||||
|
- VERSION=1
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
restart: unless-stopped
|
||||||
|
tmpfs:
|
||||||
|
- /run
|
||||||
|
app:
|
||||||
|
image: godoxy-dev
|
||||||
|
user: 1000:1000
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: dev.Dockerfile
|
||||||
|
args:
|
||||||
|
- TARGET=godoxy
|
||||||
|
container_name: godoxy-proxy-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
socket-proxy:
|
||||||
|
condition: service_started
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Hong_Kong
|
||||||
|
API_ADDR: :8999
|
||||||
|
API_USER: dev
|
||||||
|
API_PASSWORD: 1234
|
||||||
|
API_SKIP_ORIGIN_CHECK: true
|
||||||
|
API_JWT_SECURE: false
|
||||||
|
API_JWT_TTL: 24h
|
||||||
|
DEBUG: true
|
||||||
|
DOCKER_HOST: tcp://socket-proxy:2375
|
||||||
|
API_SECRET: 1234567891234567
|
||||||
|
ports:
|
||||||
|
- 8999:8999
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
volumes:
|
||||||
|
- ./dev-data/config:/app/config
|
||||||
|
- ./dev-data/certs:/app/certs
|
||||||
|
- ./dev-data/error_pages:/app/error_pages:ro
|
||||||
|
- ./dev-data/data:/app/data
|
||||||
|
- ./dev-data/logs:/app/logs
|
||||||
|
tinyauth:
|
||||||
|
image: ghcr.io/steveiliop56/tinyauth:v3
|
||||||
|
container_name: tinyauth
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- SECRET=12345678912345671234567891234567
|
||||||
|
- APP_URL=https://tinyauth.my.app
|
||||||
|
- USERS=user:$$2a$$10$$UdLYoJ5lgPsC0RKqYH/jMua7zIn0g9kPqWmhYayJYLaZQ/FTmH2/u # user:password
|
||||||
|
labels:
|
||||||
|
proxy.tinyauth.port: "3000"
|
||||||
Reference in New Issue
Block a user