From d41d680121431fab4d04ae419f7a3235d7b484b0 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 10 Oct 2020 13:01:07 +0200 Subject: [PATCH] Initial commit --- .drone.yml | 13 +++++++++++++ Dockerfile | 19 +++++++++++++++++++ entrypoint.sh | 8 ++++++++ 3 files changed, 40 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100755 entrypoint.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..641c421 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,13 @@ +kind: pipeline +name: default + +steps: + - name: docker + image: plugins/docker + settings: + registry: r.sbruder.de + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: r.sbruder.de/drone-nix-runner diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..caf10a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM nixos/nix + +RUN mv /nix/store/ /nix/store-upstream/ + +# installed from alpine to not pollute nix store +RUN apk add --no-cache \ + git \ + git-lfs \ + rsync \ + su-exec + +ARG DRONE_RUNNER_EXEC_VERSION=1.0.0-beta.9 +RUN wget -O- https://github.com/drone-runners/drone-runner-exec/releases/download/v${DRONE_RUNNER_EXEC_VERSION}/drone_runner_exec_linux_amd64.tar.gz | tar -C /usr/local/bin -xzvf- +COPY entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh"] +ENV DRONE_RUNNER_ENVIRON=NIX_PATH:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs + +EXPOSE 3000 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..0474b89 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +echo "Restoring upstream nix storeā€¦" +mkdir -p /nix/store +chmod 1775 /nix/store +chgrp nixbld /nix/store +rsync -a /nix/store-upstream/./ /nix/store +nix-daemon & +exec su-exec nobody:nogroup /usr/local/bin/drone-runner-exec