-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockerfile for local build, makefile update
- Loading branch information
yusing
committed
Jan 4, 2025
1 parent
c30d3f5
commit d44ce0e
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="[email protected]" | ||
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters