-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
41 lines (26 loc) · 792 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
34
35
36
37
38
39
40
41
FROM --platform=$BUILDPLATFORM golang:1.18-alpine as BUILD
WORKDIR /relayer
ARG TARGETARCH
ARG TARGETOS
# Update and install needed deps prioir to installing the binary.
RUN apk update && \
apk --no-cache add make git build-base
# Copy go.mod and go.sum first and download for caching go modules
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
# Copy the files from host
COPY . .
RUN export GOOS=${TARGETOS} GOARCH=${TARGETARCH} && \
make install
FROM alpine:latest
ENV RELAYER /relayer
RUN apk update && \
apk --no-cache add bash jq curl
RUN addgroup rlyuser && adduser -S -G rlyuser rlyuser -h "$RELAYER"
USER rlyuser
# Define working directory
WORKDIR $RELAYER
# Copy binary from BUILD
COPY --from=BUILD /go/bin/rly /usr/bin/rly
ENTRYPOINT ["/usr/bin/rly"]