-
Notifications
You must be signed in to change notification settings - Fork 81
/
Dockerfile
47 lines (32 loc) · 1000 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
42
43
44
45
46
47
# syntax=docker/dockerfile:1
# This is a standalone Dockerfile that does not depend on goreleaser building the binary
# It is NOT the version that is pushed to dockerhub
FROM golang:1.23.4-alpine3.21 as builder
# See "Runtime platform versions" in CONTRIBUTING.md
RUN apk --no-cache add \
libc-dev \
&& rm -rf /var/cache/apk/*
ARG SRC_DIR=/go/ld-relay
RUN mkdir -p $SRC_DIR
WORKDIR $SRC_DIR
COPY . .
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOPATH=/go
RUN go build -a -o ldr .
FROM alpine:3.21.0
RUN addgroup -g 1000 -S ldr-user && \
adduser -u 1000 -S ldr-user -G ldr-user && \
mkdir /ldr && \
chown 1000:1000 /ldr
RUN apk add --no-cache \
ca-certificates \
&& apk add --upgrade libcrypto3 libssl3 \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
ARG SRC_DIR=/go/ld-relay
COPY --from=builder ${SRC_DIR}/ldr /usr/bin/ldr
USER 1000
EXPOSE 8030
ENV PORT=8030
ENTRYPOINT ["/usr/bin/ldr", "--config", "/ldr/ld-relay.conf", "--allow-missing-file", "--from-env"]