From 6cd503711f80745ecbf762281886b4feae301799 Mon Sep 17 00:00:00 2001 From: Karcsesz Date: Mon, 1 Apr 2024 16:53:23 +0200 Subject: [PATCH] Server only docker image --- .forgejo/workflows/docker.yml | 7 ++++++- Dockerfile.serveonly | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.serveonly diff --git a/.forgejo/workflows/docker.yml b/.forgejo/workflows/docker.yml index 3e31782..2f204bb 100644 --- a/.forgejo/workflows/docker.yml +++ b/.forgejo/workflows/docker.yml @@ -19,4 +19,9 @@ jobs: with: push: true tags: karcsesz/fingerlink:latest-nano - build-args: "editor=nano" \ No newline at end of file + build-args: "editor=nano" + - uses: docker/build-push-action@v5 + with: + push: true + tags: karcsesz/fingerlink:latest-server + file: { context }/Dockerfile.serveonly \ No newline at end of file diff --git a/Dockerfile.serveonly b/Dockerfile.serveonly new file mode 100644 index 0000000..9153e1f --- /dev/null +++ b/Dockerfile.serveonly @@ -0,0 +1,24 @@ +FROM rust:latest as builder +LABEL authors="karcsesz" + +ARG target=x86_64-unknown-linux-musl + +RUN apt update && apt install -y musl-tools musl-dev +RUN update-ca-certificates +RUN rustup target add $target + +WORKDIR /fingerlink + +COPY . . + +RUN cargo build --target $target --release --no-default-features --features server + +FROM scratch + +ENV PATH="${PATH}:/fingerlink" +WORKDIR /fingerlink + +COPY --from=builder /fingerlink/target/x86_64-unknown-linux-musl/release/fingerlink /fingerlink/fingerlink + +ENTRYPOINT ["/fingerlink/fingerlink", "serve"] +CMD ["--help"] \ No newline at end of file