From 797900c216650aeb19d1a70ae4fcb3e02d4e5253 Mon Sep 17 00:00:00 2001 From: Igor Vieira Date: Sat, 6 Apr 2024 20:16:38 -0300 Subject: [PATCH] heroku workflows --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 19 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 Dockerfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..eab687b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: CI +on: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build Docker image + run: docker build -t registry.heroku.com/${{ secrets.HEROKU_APP }}/web:latest . + + - name: Docker image info + run: docker images + + - name: Login to container registry + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + run: heroku container:login + + - name: Push Docker image + run: docker push registry.heroku.com/${{ secrets.HEROKU_APP }}/web + + - name: Release + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + run: heroku container:release -a ${{ secrets.HEROKU_APP }} web diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f9bec8e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM rust:1.62 as build + +RUN USER=root cargo new --bin holy +WORKDIR /holy + +COPY ./Cargo.lock ./Cargo.lock +COPY ./Cargo.toml ./Cargo.toml +RUN cargo build --release + +RUN rm src/*.rs +COPY ./src ./src + +RUN rm ./target/release/deps/holy* +RUN cargo build --release + +FROM debian:buster-slim +COPY --from=build /holy/target/release/holy . + +CMD ["./holy"] \ No newline at end of file