improve upsert perfomance
This commit is contained in:
49
dockers/both/Dockerfile
Normal file
49
dockers/both/Dockerfile
Normal file
@ -0,0 +1,49 @@
|
||||
FROM golang:1.22-alpine as base
|
||||
|
||||
ARG VERSION="unknown"
|
||||
ARG REVISION="unknown"
|
||||
ARG BUILDTIME=""
|
||||
|
||||
WORKDIR /go/src/git.loyso.art/frx/devsim
|
||||
|
||||
ENV GOCACHE=/go/pkg/mod/
|
||||
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download -x && go mod verify
|
||||
COPY . .
|
||||
|
||||
FROM base as build-web
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
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/web \
|
||||
/go/src/git.loyso.art/frx/devsim/cmd/web/main.go
|
||||
|
||||
FROM base as build-migrator
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
go build -o /go/bin/migrator \
|
||||
/go/src/git.loyso.art/frx/devsim/cmd/migrator/main.go
|
||||
|
||||
FROM gcr.io/distroless/static-debian12@sha256:ce46866b3a5170db3b49364900fb3168dc0833dfb46c26da5c77f22abb01d8c3 as web
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build-web /go/bin/web /app/web
|
||||
|
||||
ENV DEVSIM_HTTP_ADDR=":80"
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/app/web"]
|
||||
|
||||
FROM gcr.io/distroless/static-debian12@sha256:ce46866b3a5170db3b49364900fb3168dc0833dfb46c26da5c77f22abb01d8c3 as migrator
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build-migrator /go/bin/migrator /app/migrator
|
||||
|
||||
COPY assets/db/migrations/ /app/db/migrations/
|
||||
ENV DEVSIM_PG_MIGRATOR="/app/migrations"
|
||||
|
||||
ENTRYPOINT ["/app/migrator"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user