mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-25 21:34:02 +02:00
dockerfile for local build, makefile update
This commit is contained in:
parent
c30d3f585f
commit
d44ce0ee6f
3 changed files with 64 additions and 1 deletions
59
Dockerfile.dev
Normal file
59
Dockerfile.dev
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# Stage 1: Builder
|
||||||
|
FROM golang:1.23.4-alpine AS builder
|
||||||
|
HEALTHCHECK NONE
|
||||||
|
|
||||||
|
# package version does not matter
|
||||||
|
# trunk-ignore(hadolint/DL3018)
|
||||||
|
RUN apk add --no-cache tzdata make
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Only copy go.mod and go.sum initially for better caching
|
||||||
|
COPY go.mod go.sum /src/
|
||||||
|
|
||||||
|
RUN go mod download -x
|
||||||
|
|
||||||
|
ENV GOCACHE=/root/.cache/go-build
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
ENV VERSION=${VERSION}
|
||||||
|
|
||||||
|
COPY scripts /src/scripts
|
||||||
|
COPY Makefile /src/
|
||||||
|
|
||||||
|
COPY cmd /src/cmd
|
||||||
|
COPY internal /src/internal
|
||||||
|
COPY pkg /src/pkg
|
||||||
|
|
||||||
|
RUN make build && \
|
||||||
|
mkdir -p /app/error_pages /app/certs && \
|
||||||
|
mv bin/godoxy /app/godoxy
|
||||||
|
|
||||||
|
# Stage 2: Final image
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
LABEL maintainer="yusing@6uo.me"
|
||||||
|
LABEL proxy.exclude=1
|
||||||
|
|
||||||
|
# copy timezone data
|
||||||
|
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
|
||||||
|
# copy binary
|
||||||
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
|
# copy example config
|
||||||
|
COPY config.example.yml /app/config/config.yml
|
||||||
|
|
||||||
|
# copy certs
|
||||||
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
ENV GODOXY_DEBUG=0
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 8888
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
CMD ["/app/godoxy"]
|
5
Makefile
5
Makefile
|
@ -65,4 +65,7 @@ ci-test:
|
||||||
act -n --artifact-server-path /tmp/artifacts -s GITHUB_TOKEN="$$(gh auth token)"
|
act -n --artifact-server-path /tmp/artifacts -s GITHUB_TOKEN="$$(gh auth token)"
|
||||||
|
|
||||||
cloc:
|
cloc:
|
||||||
cloc --not-match-f '_test.go$$' cmd internal pkg
|
cloc --not-match-f '_test.go$$' cmd internal pkg
|
||||||
|
|
||||||
|
push-docker-io:
|
||||||
|
BUILDER=build docker buildx build --platform linux/arm64,linux/amd64 -t docker.io/yusing/godoxy-nightly --push .
|
|
@ -74,6 +74,7 @@ func LoadComposeFiles() {
|
||||||
allMiddlewares[strutils.ToLowerNoSnake(name)] = m
|
allMiddlewares[strutils.ToLowerNoSnake(name)] = m
|
||||||
logger.Info().
|
logger.Info().
|
||||||
Str("src", path.Base(defFile)).
|
Str("src", path.Base(defFile)).
|
||||||
|
Str("name", name).
|
||||||
Msg("middleware loaded")
|
Msg("middleware loaded")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue