atmost working example

This commit is contained in:
Aleksandr Trushkin
2024-08-11 21:44:19 +03:00
parent 0046755c7d
commit 880f67aa73
16 changed files with 566 additions and 107 deletions

View File

@ -1,17 +1,23 @@
FROM golang:1.22-alpine as golang
WORKDIR /app
ARG VERSION="unknown"
ARG REVISION="unknown"
ARG BUILDTIME=""
WORKDIR /go/src/git.loyso.art/frx/devsim
COPY . .
RUN go mod download && go mod verify && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server .
RUN go mod download && \
go mod verify && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X 'git.loyso.art/frx/devsim.Version=${VERSION}' -X 'git.loyso.art/frx/devsim.Revision=${REVISION}' -X 'git.loyso.art/frx/devsim.BuildTime=${BUILDTIME}'" \
-o /go/bin/app /go/src/git.loyso.art/frx/devsim/cmd/web/main.go
FROM gcr.io/distroless/static-debian12@sha256:ce46866b3a5170db3b49364900fb3168dc0833dfb46c26da5c77f22abb01d8c3
WORKDIR /app
COPY --from=golang /server .
COPY --from=golang /go/bin/app /app
EXPOSE 9123
ENV DEVSIM_HTTP_ADDR=":9123"
ENV DEVSIM_HTTP_ADDR=":80"
EXPOSE 80
CMD ["/server"]
ENTRYPOINT ["/app"]