-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (72 loc) · 3.21 KB
/
Dockerfile
File metadata and controls
90 lines (72 loc) · 3.21 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Build status-go in a Go builder container
FROM golang:1.24.7-trixie AS builder
# Set environment variables to use Clang
ENV CC=clang
ENV CXX=clang++
RUN apt-get update \
&& apt-get install -y git bash make cmake llvm clang protobuf-compiler build-essential pkg-config curl xz-utils jq unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Nim from pre-built binaries
ARG NIM_VERSION=2.2.4
RUN set -eu && \
DPKG_ARCH="$(dpkg --print-architecture)" && \
case "$DPKG_ARCH" in \
amd64) NIM_ARCH="x64" ;; \
arm64) NIM_ARCH="arm64" ;; \
*) echo "Unsupported architecture: $DPKG_ARCH" >&2; exit 1 ;; \
esac && \
NIM_URL=$(curl -sSf https://nim-lang.org/releases.json \
| jq -r --arg ver "$NIM_VERSION" --arg arch "$NIM_ARCH" \
'.[$ver]["linux_" + $arch].github_url // empty') && \
if [ -z "$NIM_URL" ]; then \
echo "ERROR: No download URL found for Nim $NIM_VERSION linux_$NIM_ARCH" >&2; \
exit 1; \
fi && \
curl -sSfL "$NIM_URL" -o /tmp/nim.tar.xz && \
mkdir -p /opt/nim && \
tar -xJf /tmp/nim.tar.xz -C /opt/nim --strip-components=1 && \
rm /tmp/nim.tar.xz && \
/opt/nim/bin/nim --version
ENV PATH="/opt/nim/bin:${PATH}"
ARG build_tags='gowaku_no_rln'
ARG build_flags=''
ARG build_target='cmd'
ARG use_logos_storage='false'
RUN mkdir -p /go/src/github.com/status-im/status-go
WORKDIR /go/src/github.com/status-im/status-go
ADD go.mod go.sum ./
RUN go mod download
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.1
ADD . .
ARG cache_id='local'
ARG enable_go_cache=true
RUN if [ "$enable_go_cache" = "true" ]; then \
go env -w GOCACHE=/root/.cache/go-build; \
fi
RUN --mount=type=cache,target="/root/.cache/go-build",id=statusgo-build-$cache_id \
make $build_target BUILD_TAGS="$build_tags" BUILD_FLAGS="$build_flags" USE_LOGOS_STORAGE="$use_logos_storage"
# Stage runtime shared libraries required by built binaries.
RUN mkdir -p /tmp/status-runtime-libs \
&& cp /go/src/github.com/status-im/nim-sds/build/libsds.so /tmp/status-runtime-libs/ \
&& if [ -f /go/src/github.com/status-im/logos-storage-nim/build/libstorage.so ]; then \
cp /go/src/github.com/status-im/logos-storage-nim/build/libstorage.so /tmp/status-runtime-libs/; \
fi
# Copy binaries to the second image
FROM debian:trixie-slim
LABEL maintainer="support@status.im"
LABEL source="https://github.com/status-im/status-go"
LABEL description="status-go is an underlying part of Status - a browser, messenger, and gateway to a decentralized world."
RUN apt-get update \
&& apt-get install -y ca-certificates bash curl python3 libgomp1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/status-user && chmod -R 777 /usr/status-user
RUN mkdir -p /static/configs
COPY --from=builder /go/src/github.com/status-im/status-go/build/bin/status-backend /usr/local/bin/
COPY --from=builder /go/src/github.com/status-im/status-go/build/bin/push-notification-server /usr/local/bin/
COPY --from=builder /go/src/github.com/status-im/status-go/tests-functional/waku_configs/* /static/configs/
COPY --from=builder /tmp/status-runtime-libs/ /usr/local/lib/
ENV LD_LIBRARY_PATH=/usr/local/lib/
EXPOSE 8080 8545 30303 30303/udp 30304/udp
CMD ["status-backend", "--help"]