6e5c7aedc8
Add Devbox * adddevbox * cleanupdockerfile * testscripts
27 lines
544 B
Docker
27 lines
544 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG GO_VERSION=1.23
|
|
|
|
FROM golang:${GO_VERSION} AS build
|
|
|
|
WORKDIR /app
|
|
|
|
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
|
|
|
|
ARG TARGETARCH
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
|
--mount=type=bind,target=. \
|
|
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin ./cmd/...
|
|
|
|
FROM scratch AS final
|
|
|
|
WORKDIR /app
|
|
|
|
COPY database/migrations/ database/migrations/
|
|
|
|
COPY --from=build /bin/ .
|