forked from bloXroute-Labs/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (57 loc) · 1.85 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ARG GO_VERSION=alpine
ARG BASE=golang:1.23.2-alpine3.20
FROM ${BASE} AS builder
RUN apk update \
&& apk add --no-cache \
linux-headers \
gcc \
libtool \
openssl-dev \
libffi \
tini \
git \
'su-exec>=0.2' \
&& apk add --no-cache --virtual .build_deps build-base libffi-dev
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN addgroup -g 502 -S bloxroute \
&& adduser -u 502 -S -G bloxroute bloxroute \
&& mkdir -p /app/bloxroute/logs \
&& chown -R bloxroute:bloxroute /app/bloxroute
# Move to working directory
WORKDIR /app/bloxroute
# Download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY --chown=bloxroute:bloxroute . .
RUN make gateway
RUN chown bloxroute:bloxroute ./bin/gateway
RUN chown bloxroute:bloxroute ./bin/bxcli
FROM golang:${GO_VERSION}
RUN apk update \
&& apk add --no-cache \
linux-headers \
gcc \
libtool \
openssl-dev \
libffi \
tini \
git \
'su-exec>=0.2' \
&& apk add --no-cache --virtual .build_deps build-base libffi-dev
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN addgroup -g 502 -S bloxroute \
&& adduser -u 502 -S -G bloxroute bloxroute \
&& mkdir -p /app/bloxroute/logs \
&& mkdir -p /app/bloxroute/datadir \
&& chown -R bloxroute:bloxroute /app/bloxroute
# Move to working directory
WORKDIR /app/bloxroute
RUN chmod +s /bin/ping
RUN chmod +s /bin/busybox
COPY --from=builder /app/bloxroute/bin/bxcli /app/bloxroute/bin/bxcli
COPY --from=builder /app/bloxroute/bin/gateway /app/bloxroute/bin/gateway
COPY docker-entrypoint.sh /usr/local/bin/
ENV PATH="/app/bloxroute/bin:${PATH}"
EXPOSE 1801 5001
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh", "/usr/local/bin/docker-entrypoint.sh"]