freenet/Dockerfile
Merith-TK e6e946ce44
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 9s
it builds and it runs, needs further testing
2025-04-21 14:16:22 -07:00

54 lines
No EOL
1.4 KiB
Docker

# Stage 1: Builder
FROM rust:slim-bookworm AS builder
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
clang \
llvm \
libclang-dev \
libssl-dev \
pkg-config \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# First clone without submodules
WORKDIR /src
RUN git clone --depth 1 https://github.com/freenet/freenet-core.git freenet
# Change submodule URLs from SSH to HTTPS
WORKDIR /src/freenet
RUN sed -i 's|git@github.com:|https://github.com/|' .gitmodules && \
git submodule sync && \
git submodule update --init --recursive
# Build the core crate (correct package specification)
WORKDIR /src/freenet/crates/core
RUN cargo build --release
# Stage 2: Runner
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
gosu \
&& rm -rf /var/lib/apt/lists/*
# Create default non-root user
RUN useradd -m -u 1000 -s /bin/bash freenetuser && \
mkdir -p /data && \
chown freenetuser:freenetuser /data
# Copy binary and entrypoint
COPY --from=builder /src/freenet/target/release/freenet /usr/local/bin/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Environment variables
ENV DATA_DIR="/data/data" \
CONFIG_DIR="/data/config"
VOLUME ["/data"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["freenet"]