mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2025-07-02 01:39:27 +00:00
New whatismydns feature (#29)
This commit is contained in:
30
Dockerfile
30
Dockerfile
@ -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"]
|
||||
|
Reference in New Issue
Block a user