Compare commits

...

6 Commits

Author SHA1 Message Date
Patrick Cleavelin cfbe0b71a9 no docker, only nix
use correct tag

just use docker instead of artifact

save result of nix build in persistent volume
2023-07-31 15:25:46 -05:00
Patrick Cleavelin 575c2fa6d0 docker? 2023-07-31 15:22:27 -05:00
Patrick Cleavelin 182de458ee will this actually work, probably not 2023-07-31 15:22:27 -05:00
Patrick Cleavelin 444203405d update syntax 2023-07-31 15:22:27 -05:00
Patrick Cleavelin fa83ca21e3 remove asdf 2023-07-31 15:22:27 -05:00
Patrick Cleavelin c749134a2f ci maybe? 2023-07-31 15:22:27 -05:00
3 changed files with 55 additions and 2 deletions

21
.woodpecker.yml Normal file
View File

@ -0,0 +1,21 @@
steps:
build-docker-image:
image: alpine:edge
commands:
- apk add --no-cache git nix --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
- echo "system-features = nixos-test benchmark big-parallel uid-range kvm" > /etc/nix/nix.conf
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#docker
- cp $(nix build --extra-experimental-features nix-command --extra-experimental-features flakes --print-out-paths .#docker) ./memejoin-rs.tar.gz
publish-image:
when:
event: tag
image: docker
secrets: [ forgejo_token ]
commands:
- docker login -u ${CI_REPO_OWNER} --password $FORGEJO_TOKEN git.spacegirl.nl
- docker image load --input memejoin-rs.tar.gz
- docker image tag memejoin-rs:${CI_COMMIT_TAG} git.spacegirl.nl/${CI_REPO}:${CI_COMMIT_TAG}
- docker image push git.spacegirl.nl/${CI_REPO}:${CI_COMMIT_TAG}
volumes:
- /var/run/docker.sock:/var/run/docker.sock

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM rust-1.73.0-slim AS builder
RUN USER=root cargo new --bin memejoin-docker
WORKDIR ./memejoin-docker
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release
RUN rm src/*.rs
ADD . ./
RUN rm ./target/release/deps/memejoin-docker
RUN cargo build --release
FROM debian:buster-slim
ARG APP=/usr/src/app
RUN apt update \
&& apt install -y ca-certificates cmake gcc libopus libssl openssl pkg-config \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 8100
RUN groupadd $APP_USER && useradd -g $APP_USER $APP_USER && mkdir -p ${APP}
COPY --from=builder /memejoin-docker/target/release/memejoin-docker ${APP}/memejoin-docker
RUN chown -R $APP_USER:$APP_USER ${APP}
USER $APP_USER
WORKDIR ${APP}
CMD ["./memejoin-docker"]

View File

@ -8,6 +8,7 @@
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
tag = "0.1.4_3-alpha";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
@ -45,8 +46,8 @@
packages = with pkgs; flake-utils.lib.flattenTree rec {
default = rustPlatform.buildRustPackage rec {
inherit tag;
name = "memejoin-rs";
version = "0.1.4_2-alpha";
src = self;
buildInputs = [ openssl.dev ];
nativeBuildInputs = [ local-rust pkg-config openssl openssl.dev cmake gcc libopus ];
@ -57,8 +58,8 @@
};
docker = dockerTools.buildImage {
inherit tag;
name = "memejoin-rs";
tag = "0.1.4_2-alpha";
copyToRoot = buildEnv {
name = "image-root";
paths = [ default cacert openssl openssl.dev ffmpeg libopus youtube-dl yt-dlp ];