From c3912698db717e4d30f4c8ec218de6262e067d66 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 14 Feb 2024 04:24:07 +0100 Subject: [PATCH] add support for docker deployments --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ 2 files changed, 38 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..a990b4f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: Publish a new Docker image + +on: + push: + branches: [master] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: docker/build-push-action@v5 + with: + push: true + context: . + platforms: linux/amd64,linux/arm64 + tags: chrissx/jana:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b43ccc2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM dart:stable AS build + +WORKDIR /app +COPY pubspec.yaml . +RUN dart pub get +COPY bin ./bin +RUN dart compile exe bin/jana.dart -o bin/app + +FROM scratch +COPY --from=build /runtime/ / +COPY --from=build /app/bin/app /app/bin/ + +ENV JANA_DISCORD_TOKEN= + +CMD ["/app/bin/app"]