New whatismydns feature (#29)

This commit is contained in:
2024-04-12 19:26:48 +02:00
committed by GitHub
parent b11f15ecfe
commit d13ea29071
20 changed files with 1571 additions and 210 deletions

View File

@ -1,22 +1,28 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder
ARG ARG_VERSION
ENV VERSION $ARG_VERSION
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN --mount=type=cache,target=/go/pkg/mod/ go mod download -x
COPY . .
RUN apk add make git upx && make build VERSION=$VERSION \
FROM builder AS build-dev-app
# hadolint ignore=DL3018
RUN --mount=type=cache,target=/go/pkg/mod/ apk --no-cache add make && make build
FROM builder AS build-prod-app
# hadolint ignore=DL3018
RUN --mount=type=cache,target=/go/pkg/mod/ apk --no-cache add make upx \
&& make build \
&& upx --best --lzma whatismyip
# Build final image
FROM scratch
WORKDIR /app
COPY --from=builder /app/whatismyip /usr/bin/
EXPOSE 8080
FROM scratch AS dev
COPY --from=build-dev-app /app/whatismyip /usr/bin/
ENTRYPOINT ["whatismyip"]
FROM scratch AS prod
COPY --from=build-prod-app /app/whatismyip /usr/bin/
ENTRYPOINT ["whatismyip"]