-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,570 additions
and
209 deletions.
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,49 @@ | ||
--- | ||
run: | ||
timeout: 10m | ||
issues: | ||
max-same-issues: 0 | ||
linters: | ||
disable-all: true | ||
enable: | ||
- goimports | ||
- ineffassign | ||
- nakedret | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
linters-settings: | ||
staticcheck: | ||
checks: | ||
- all | ||
revive: | ||
ignore-generated-header: true | ||
severity: warning | ||
confidence: 0.8 | ||
rules: | ||
- name: blank-imports | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
- name: error-return | ||
- name: error-strings | ||
- name: error-naming | ||
- name: exported | ||
- name: increment-decrement | ||
- name: var-naming | ||
- name: var-declaration | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: indent-error-flow | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: unused-parameter | ||
- name: unreachable-code | ||
- name: redefines-builtin-id |
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 |
---|---|---|
@@ -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 \ | ||
&& upx --best --lzma whatismyip | ||
|
||
# Build final image | ||
FROM scratch | ||
FROM builder AS build-dev-app | ||
# hadolint ignore=DL3018 | ||
RUN --mount=type=cache,target=/go/pkg/mod/ apk --no-cache add make && make build | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/whatismyip /usr/bin/ | ||
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 | ||
|
||
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"] |
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
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
Oops, something went wrong.