-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ExtraActions and Dynamic GORM query driver
- Loading branch information
Showing
44 changed files
with
2,164 additions
and
420 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
FROM golang:alpine as builder | ||
ARG GO_VERSION=1.21.1 | ||
|
||
|
||
RUN apk update && apk add --no-cache git ca-certificates gcc musl-dev && update-ca-certificates | ||
|
||
ENV USER=user | ||
ENV UID=10001 | ||
|
||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
"${USER}" | ||
|
||
WORKDIR /app | ||
COPY go.mod . | ||
COPY go.sum . | ||
# Build stage | ||
FROM golang:${GO_VERSION}-bullseye AS build | ||
|
||
RUN useradd -u 1000 nonroot -m | ||
USER nonroot:nonroot | ||
WORKDIR /src | ||
COPY ./go.mod ./go.sum ./ | ||
|
||
RUN go mod download | ||
RUN go mod verify | ||
COPY pkg ./pkg | ||
RUN CGO_ENABLED=1 go build \ | ||
-installsuffix 'static' \ | ||
-o /home/nonroot/app ./pkg/examples/products/main.go | ||
|
||
# Dev stage, can be used for development using docker-compose "build.target" config | ||
FROM build as dev | ||
WORKDIR /home/nonroot | ||
ARG VERSION=dev | ||
ENV VERSION=${VERSION} | ||
ENTRYPOINT ["/home/nonroot/app"] | ||
CMD ["start"] | ||
|
||
COPY pkg pkg | ||
env CGO_ENABLED=1 | ||
RUN GOOS=linux GOARCH=amd64 go build -o /go/bin/products pkg/examples/products/main.go | ||
RUN chmod +x /go/bin/products | ||
FROM alpine | ||
ENV GIN_MODE=release | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /etc/passwd /etc/passwd | ||
COPY --from=builder /etc/group /etc/group | ||
COPY --from=builder /go/bin/products /go/bin/products | ||
USER user:user | ||
ENTRYPOINT ["/go/bin/products"] | ||
# Prod stage, uses distrolless image | ||
FROM gcr.io/distroless/base AS prod | ||
ARG VERSION=dev | ||
ENV VERSION=${VERSION} | ||
USER nonroot:nonroot | ||
COPY --from=build --chown=nonroot:nonroot /home/nonroot/app /home/nonroot/app | ||
LABEL maintainer="https://github.com/glothriel" | ||
ENTRYPOINT ["/home/nonroot/app"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"root_group":{"name":"","path":"","id":"d41d8cd98f00b204e9800998ecf8427e","groups":[{"name":"setup","path":"::setup","id":"5c0f8025f7e0b6654089e5b00e950f1a","groups":[],"checks":[{"id":"77976cc76c32d08c6bf343022a4547eb","passes":3,"fails":0,"name":"product is created","path":"::setup::product is created"}]},{"name":"teardown","path":"::teardown","id":"a8a9942382e8ffe2e56ef29e664b8229","groups":[],"checks":[{"name":"product is deleted","path":"::teardown::product is deleted","id":"978916e86e81789dc672a1af8a257a7a","passes":3,"fails":0}]}],"checks":[]},"options":{"summaryTrendStats":["avg","min","med","max","p(90)","p(95)"],"summaryTimeUnit":"","noColor":false},"state":{"isStdOutTTY":true,"isStdErrTTY":true,"testRunDurationMs":3028.827282},"metrics":{"iterations":{"type":"counter","contains":"default","values":{"count":9105,"rate":3006.1139683038555}},"http_req_waiting":{"type":"trend","contains":"time","values":{"p(95)":0.28385869999999996,"avg":0.24414285990126153,"min":0.192764,"med":0.232434,"max":5.171587,"p(90)":0.26498}},"http_req_duration{expected_response:true}":{"type":"trend","contains":"time","values":{"max":5.222222,"p(90)":0.30291900000000005,"p(95)":0.32406630000000003,"avg":0.2788634223806909,"min":0.219933,"med":0.266726}},"http_req_failed":{"type":"rate","contains":"default","values":{"fails":9115,"rate":0,"passes":0}},"iteration_duration":{"type":"trend","contains":"time","values":{"avg":0.31991549017239557,"min":0.258136,"med":0.306397,"max":15.247754,"p(90)":0.34756159999999997,"p(95)":0.36963129999999983}},"http_req_connecting":{"type":"trend","contains":"time","values":{"p(90)":0,"p(95)":0,"avg":0.00004366758091058694,"min":0,"med":0,"max":0.169157}},"data_received":{"type":"counter","contains":"data","values":{"count":2915926,"rate":962724.4238484775}},"checks":{"type":"rate","contains":"default","values":{"rate":1,"passes":6,"fails":0}},"http_req_sending":{"type":"trend","contains":"time","values":{"max":0.070261,"p(90)":0.010546,"p(95)":0.011454,"avg":0.008327501151947327,"min":0.004679,"med":0.008031}},"vus_max":{"type":"gauge","contains":"default","values":{"value":1,"min":1,"max":1}},"http_req_tls_handshaking":{"type":"trend","contains":"time","values":{"med":0,"max":0,"p(90)":0,"p(95)":0,"avg":0,"min":0}},"vus":{"type":"gauge","contains":"default","values":{"value":1,"min":1,"max":1}},"http_req_duration":{"type":"trend","contains":"time","values":{"avg":0.2788634223806909,"min":0.219933,"med":0.266726,"max":5.222222,"p(90)":0.30291900000000005,"p(95)":0.32406630000000003}},"http_req_receiving":{"type":"trend","contains":"time","values":{"min":0.012781,"med":0.02619,"max":0.367788,"p(90)":0.031429,"p(95)":0.033384,"avg":0.02639306132748222}},"data_sent":{"type":"counter","contains":"data","values":{"count":802845,"rate":265067.93727434473}},"http_req_blocked":{"values":{"min":0.002793,"med":0.004679,"max":0.306257,"p(90)":0.005238,"p(95)":0.005587,"avg":0.004666356555128879},"type":"trend","contains":"time"},"http_reqs":{"contains":"default","values":{"count":9115,"rate":3009.4155761767865},"type":"counter"}}} |
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.