-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 796 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM --platform=$BUILDPLATFORM golang:1.26.1 AS build
RUN mkdir /storage
WORKDIR /go/src/github.com/traPtitech/traQ
COPY ./go.* ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
ENV GOCACHE=/tmp/go/cache
ENV CGO_ENABLED=0
ARG TRAQ_VERSION=dev
ARG TRAQ_REVISION=local
ARG TARGETOS
ARG TARGETARCH
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/tmp/go/cache \
go build -o /traQ -ldflags "-s -w -X main.version=$TRAQ_VERSION -X main.revision=$TRAQ_REVISION"
FROM gcr.io/distroless/base:latest
WORKDIR /app
EXPOSE 3000
COPY --from=build /storage/ /app/storage/
VOLUME /app/storage
COPY --from=build /traQ ./
HEALTHCHECK CMD ["./traQ", "healthcheck", "||", "exit", "1"]
ENTRYPOINT ["./traQ"]
CMD ["serve"]