Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ducc committed Feb 7, 2024
1 parent b3ec967 commit 183b045
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
grafana-storage/
target/
Dockerfile
9 changes: 6 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Build
run: cargo build
- name: Run tests
run: cargo test
run: docker build -t ghcr.io/ducc/calories:$GITHUB_SHA -t ghcr.io/ducc/calories:latest -f Dockerfile .

- name: Push
if: github.ref == 'refs/heads/master'
run: docker push ghcr.io/ducc/calories:$GITHUB_SHA ghcr.io/ducc/calories:latest
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rust:1.75-bullseye as builder
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/calories /usr/local/bin/calories
CMD ["calories"]

0 comments on commit 183b045

Please sign in to comment.