diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a96e552 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git/ +target/ diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..c7d4995 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,9 @@ +name: PR +on: + pull_request: {} +jobs: + pr: + runs-on: ubuntu-22.04 + steps: + - name: Build Docker container + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2f03c48 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Lightly adapted from https://hub.docker.com/_/rust + +FROM docker.io/library/rust:1.82-slim-bookworm AS builder +WORKDIR /usr/local/src/app +COPY . . +RUN rustup component add clippy rustfmt +RUN cargo fmt --check +RUN cargo clippy --no-deps +RUN cargo test +RUN cargo install --path . + +FROM docker.io/library/debian:bookworm-slim +COPY --from=builder /usr/local/cargo/bin/docker-cron /usr/local/bin/docker-cron +CMD ["docker-cron","/etc/crontab"]