Commit 02505e2c authored by Silvio Rhatto's avatar Silvio Rhatto
Browse files

Merge branch 'feat/dockerfile' into 'main'

Initial container image for Onionmine (#29)

See merge request !31
parents ec864c26 d6337361
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -2,15 +2,14 @@
include:
  - local: '.gitlab-ci-pages.yml'

variables:
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_SUBMODULE_DEPTH: 1

test:
  image: containers.torproject.org/tpo/tpa/base-images/debian:stable
  stage: test
  script:
    # Initialize repository
    - apt-get update
    - apt-get install -y git
    - git submodule sync
    - git submodule update --init --recursive --depth 1

    # Install Onionmine dependencies
    - ./onionmine install-dependencies
    - ./onionmine check-dependencies
@@ -32,6 +31,13 @@ test:
    - ./onionmine wipe-pool-secrets example.org --force
    - ./onionmine wipe-pool example.org --force

container:
  image: containers.torproject.org/tpo/tpa/base-images/podman:bookworm
  stage: build
  script:
    # Build image
    - podman build .

release:
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  stage: .post

Dockerfile

0 → 100644
+58 −0
Original line number Diff line number Diff line
#
# Dockerfile for Onionmine.
#
# Adapted from
#
#   https://github.com/cathugger/mkp224o/blob/master/contrib/docker/Dockerfile
#   https://github.com/HARICA-official/onion-csr/blob/master/Dockerfile
#
# Copyright (C) 2025 The Tor Project, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

FROM alpine:latest AS onionmine
MAINTAINER Silvio Rhatto <rhatto@torproject.org>

# Dependencies
RUN apk add --no-cache gcc libc-dev libsodium-dev libsodium-static make autoconf
RUN apk add --no-cache ruby
RUN apk add --no-cache bash rsync wipe curl tor netcat-openbsd

WORKDIR /app

# Copy the needed files
COPY bin       /app/bin
COPY lib       /app/lib
COPY vendor    /app/vendor
COPY onionmine /app/

# Copy configuration
#COPY onionmine.conf /app
#COPY onionmine.conf.sample /app

# Build mkp224o
RUN cd vendor/mkp224o && ./autogen.sh
RUN cd vendor/mkp224o && ./configure --enable-amd64-51-30k \
    CFLAGS="-O3 -march=x86-64 -mtune=generic -fomit-frame-pointer" \
    LDFLAGS="-static"
RUN make -C vendor/mkp224o
RUN strip vendor/mkp224o/mkp224o

# Build onion-csr
RUN gem install ffi
RUN rm -f vendor/onion-csr/libed25519.so
RUN cd vendor/onion-csr && gcc -shared -o libed25519.so -fPIC ed25519/src/*.c

ENTRYPOINT ["./onionmine"]
+2 −1
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ if [ "$ID" == "debian" ]; then
  # Install dependencies
  echo "$BASENAME: running installation procedure for $ID..."
  echo "$BASENAME: installing $DEPENDENCIES_DEBIAN..."
  $SUDO apt install -y $DEPENDENCIES_DEBIAN || exit 1
  $SUDO apt-get update
  $SUDO apt-get install -y $DEPENDENCIES_DEBIAN || exit 1
else
  echo "$BASENAME: unsupported automatic installation for operating system $ID, please install dependencies manually"
  exit 1
+5 −1
Original line number Diff line number Diff line
@@ -84,7 +84,11 @@ fi
if [ ! -e "$BASEDIR/vendor/onion-csr/libed25519.so" ]; then
  echo "Building onion-csr (HARICA implementation)..."
  cd $BASEDIR/vendor/onion-csr                       || exit 1

  if [ ! -e "ed25519/src" ]; then
    git submodule update --init --recursive || exit 1
  fi

  gcc -shared -o libed25519.so -fPIC ed25519/src/*.c || exit 1
fi

+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ Set the version number:
Update the version in some files, like:

    $EDITOR lib/params
    $EDITOR docker-compose.yml

### Register the changes

Loading