Skip to content

Commit b1ca77e

Browse files
authored
chore: fix docker build (#975)
1 parent 6dc96b0 commit b1ca77e

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15-
FROM ubuntu:22.04
15+
FROM ubuntu:24.04
1616

1717
LABEL maintainer="Webb Developers <dev@webb.tools>"
1818
LABEL description="Tangle Network Node"

docker/Tangle.Dockerfile

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,55 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15-
FROM ubuntu:22.04
1615

17-
COPY ../target/release/tangle /usr/local/bin/
16+
# Build stage
17+
FROM ubuntu:22.04 AS builder
18+
19+
LABEL maintainer="Webb Developers <dev@webb.tools>"
20+
LABEL description="Tangle Network Builder"
21+
22+
# Install dependencies required for building
23+
RUN apt-get update && apt-get install -y --no-install-recommends \
24+
curl ca-certificates git build-essential \
25+
clang cmake pkg-config libssl-dev libc6 zlib1g-dev libtinfo-dev \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# Install Rust
29+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
30+
ENV PATH="/root/.cargo/bin:${PATH}"
31+
32+
# Copy the source code
33+
WORKDIR /build
34+
COPY . /build
35+
36+
# Build the Tangle binary
37+
RUN cargo build --release
38+
39+
# Verify the binary works in this environment
40+
RUN /build/target/release/tangle --version
41+
42+
# Run stage - using the same Ubuntu 22.04 to ensure binary compatibility
43+
FROM ubuntu:22.04
1844

1945
LABEL maintainer="Webb Developers <dev@webb.tools>"
2046
LABEL description="Tangle Network Node"
2147

48+
# Install minimal runtime dependencies
2249
RUN apt-get update && apt-get install -y --no-install-recommends \
23-
curl \
24-
ca-certificates libc6 \
50+
ca-certificates libc6 zlib1g-dev libtinfo-dev \
2551
&& rm -rf /var/lib/apt/lists/*
2652

53+
# Copy the binary from builder stage
54+
COPY --from=builder /build/target/release/tangle /usr/local/bin/
55+
56+
# Create user and set up directories
2757
RUN useradd -m -u 5000 -U -s /bin/sh -d /tangle tangle && \
2858
mkdir -p /data /tangle/.local/share && \
2959
chown -R tangle:tangle /data && \
3060
ln -s /data /tangle/.local/share/tangle && \
3161
# unclutter and minimize the attack surface
3262
rm -rf /usr/bin /usr/sbin && \
33-
# check if executable works in this container
63+
# Verify the binary works in the final container
3464
/usr/local/bin/tangle --version
3565

3666
USER tangle

0 commit comments

Comments
 (0)