Enable very rudimentary CI/CD (#1)
Some checks are pending
/ docker build (push) Blocked by required conditions
/ cargo test (push) Successful in 22s

Reviewed-on: #1
Co-authored-by: Karcsesz <git@karcsesz.hu>
Co-committed-by: Karcsesz <git@karcsesz.hu>
This commit is contained in:
Karcsesz 2024-03-18 01:54:16 +01:00 committed by Karcsesz
parent 61a3c10377
commit 2e86deb862
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,24 @@
on:
push:
branches:
- master
jobs:
docker:
name: docker build
runs-on: ubuntu-22.04
needs:
- test
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME}}
password: ${{ secrets.DOCKERHUB_TOKEN}}
- uses: docker/build-push-action@v5
with:
push: true
tags: karcsesz/fingerlink:latest
- uses: docker/build-push-action@v5
with:
push: true
tags: karcsesz/fingerlink:latest-nano
build-args: "editor=nano"

View file

@ -0,0 +1,9 @@
on: [push]
jobs:
test:
name: cargo test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/rust-toolchain@stable
- run: cargo test --all-features

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
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
FROM alpine:latest
ARG editor=vim
RUN apk add --no-cache $editor
ENV EDITOR=$editor
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"]