Enable very rudimentary CI/CD #1
3 changed files with 61 additions and 0 deletions
24
.forgejo/workflows/docker.yml
Normal file
24
.forgejo/workflows/docker.yml
Normal 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"
|
9
.forgejo/workflows/test.yml
Normal file
9
.forgejo/workflows/test.yml
Normal 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
28
Dockerfile
Normal 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"]
|
Loading…
Reference in a new issue