-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (21 loc) · 995 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
ARG BUILDPLATFORM="linux/amd64"
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN apk add --no-cache git
COPY ./ /go/src/github.com/meyskens/ris-at-home
WORKDIR /go/src/github.com/meyskens/ris-at-home
RUN export GOARM=6 && \
export GOARCH=amd64 && \
if [ "$TARGETPLATFORM" == "linux/arm64" ]; then export GOARCH=arm64; fi && \
if [ "$TARGETPLATFORM" == "linux/arm" ]; then export GOARCH=arm; fi && \
go build -ldflags "-X main.revision=$(git rev-parse --short HEAD)" ./apiserver/cmd/risapi/
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
RUN mkdir -p /go/src/github.com/meyskens/ris-at-home
WORKDIR /go/src/github.com/meyskens/ris-at-home
COPY --from=build /go/src/github.com/meyskens/ris-at-home/risapi /usr/local/bin/
COPY --from=build /go/src/github.com/meyskens/ris-at-home/public /go/src/github.com/meyskens/ris-at-home/public
ENV RIS_PORT=80
ENTRYPOINT [ "/usr/local/bin/risapi" ]
CMD [ "serve" ]