-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
56 lines (38 loc) · 1.15 KB
/
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
48
49
50
51
52
53
54
55
56
#syntax=docker/dockerfile-upstream:1.6
FROM golang:1.23.2-alpine AS builder
LABEL maintainer "Derek Collison <[email protected]>"
LABEL maintainer "Waldemar Quevedo <[email protected]>"
ARG TARGETARCH
ARG VERSION_NATS
ARG VERSION_NATS_TOP
ARG VERSION_NSC
ENV GOPATH /go/${TARGETARCH}
RUN <<EOT
set -e
mkdir -p ${GOPATH}
go install -ldflags="-X main.version=${VERSION_NSC}" github.com/nats-io/nsc/v2@v${VERSION_NSC}
go install github.com/nats-io/nats-top@v${VERSION_NATS_TOP}
go install github.com/nats-io/natscli/nats@v${VERSION_NATS}
EOT
FROM alpine:3.20.3
ARG TARGETARCH
COPY --from=builder /go/${TARGETARCH}/bin/* /usr/local/bin
RUN <<EOT
set -e
apk -U upgrade
apk add --no-cache ca-certificates curl figlet jq
rm -rf /var/cache/apk && mkdir /var/cache/apk
addgroup -g 1000 nats
adduser -D -u 1000 -G nats nats
mkdir -p /nsc
chown nats:root /nsc /home/nats
chmod 0775 /nsc /home/nats
EOT
ENV NKEYS_PATH /nsc/nkeys
ENV XDG_DATA_HOME /nsc
ENV XDG_CONFIG_HOME /nsc/.config
COPY entrypoint.sh /entrypoint.sh
COPY profile.sh /etc/profile.d
RUN chmod +x /entrypoint.sh
WORKDIR /root
ENTRYPOINT ["/entrypoint.sh"]