-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (31 loc) · 936 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1
FROM golang:1.18-alpine as builder
RUN apk update && \
apk upgrade && \
apk --no-cache add git
RUN mkdir /build
ADD . /build/
WORKDIR /build
ARG COMMIT
ARG LASTMOD
ARG VERSION
ARG BUILTBY
RUN echo "INFO: building for $COMMIT on $LASTMOD"
RUN \
CGO_ENABLED=0 GOOS=linux go build \
-a \
-installsuffix cgo \
-ldflags "-X main.commit=$COMMIT -X main.date=$LASTMOD -X main.version=$VERSION -X main.builtBy=$BUILTBY -extldflags '-static'" \
-o fflint-online cmd/online/main.go
RUN \
CGO_ENABLED=0 GOOS=linux go build \
-a \
-installsuffix cgo \
-ldflags "-X main.commit=$COMMIT -X main.date=$LASTMOD -X main.version=$VERSION -X main.builtBy=$BUILTBY -extldflags '-static'" \
-o fflint cmd/fflint/main.go
FROM scratch
COPY --from=builder /build/fflint /app/
COPY --from=builder /build/fflint-online /app/
WORKDIR /app
ENV PORT 4000
ENTRYPOINT ["./fflint-online"]