archivebox/sonic

Sponsored OSS

By ArchiveBox

Updated over 1 year ago

This is a multi-arch build of valeriansaliou/sonic that supports arm64 and amd64.

Image
Databases & storage
2

500K+

archivebox/sonic repository overview

This is a multi-arch build of valeriansaliou/sonic for arm64 and amd64.

It can be used in a multi-stage build to bundle sonic inside your container without having to install cargo/brew/build it from source.

Usage
FROM python:3.11-slim-bookworm  # testd on bookworm but likely works on others

... # your dockerfile contents here

COPY --from=archivebox/sonic /usr/local/bin/sonic /usr/local/bin/sonic

RUN /usr/local/bin/sonic --version

...

Source

Here is the Dockerfile for archivebox/sonic:

FROM rust:slim-bookworm

ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \
    --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked,id=cargoreg-$TARGETARCH$TARGETVARIANT \
    --mount=type=cache,target=/usr/local/cargo/git,sharing=locked,id=cargogit-$TARGETARCH$TARGETVARIANT \
    --mount=type=cache,target=/app,sharing=locked,id=sonicgit-$TARGETARCH$TARGETVARIANT \
    # install build dependencies
    apt-get update -qq \
    && apt-get install -qq -y build-essential clang git \
    && rustup component add rustfmt \
    && rustc --version \
    && rustup --version \
    && cargo --version \
    && mkdir -p /app \
    # update or clone the sonic source code
    && ((cd /app/sonic && git pull) || (git clone https://github.com/valeriansaliou/sonic /app/sonic)) \
    && cd /app/sonic \
    # build the sonic binary from source
    && cargo clean \
    && cargo build --release --target "$(uname -m)"-unknown-linux-gnu \
    && strip "/app/sonic/target/$(uname -m)-unknown-linux-gnu/release/sonic" \
    && mv "/app/sonic/target/$(uname -m)-unknown-linux-gnu/release/sonic" /usr/local/bin/sonic \
    # remove build dependencies
    && apt-get purge -qq -y build-essential clang git \
    && apt-get autoremove -qq -y \
    && rm -rf /var/lib/apt/lists/* \
    # verify the sonic binary works
    && /usr/local/bin/sonic --version

# copy the ArchiveBox default sonic config into the image
COPY etc/sonic.cfg /etc/sonic.cfg

CMD [ "/usr/local/bin/sonic", "-c", "/etc/sonic.cfg" ]

EXPOSE 1491

This is the build command:

cd ArchiveBox/   # cd into the ArchiveBox repo first
nano Dockerfile  # paste in contents of the Dockerfile above

docker buildx build \
    --platform "linux/amd64,linux/arm64" \
    --push . \
    -t archivebox/sonic:1.4.9 \
    -t archivebox/sonic:latest

Links:

Tag summary

Content type

Image

Digest

sha256:452064bfd

Size

289.8 MB

Last updated

over 1 year ago

docker pull archivebox/sonic

This week's pulls

Pulls:

7,103

Last week