Skip to content

Commit

Permalink
Docker Build
Browse files Browse the repository at this point in the history
  • Loading branch information
rblaine95 committed Nov 7, 2023
1 parent b677044 commit 67114c3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ concurrency:
group: cicd-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
test:
name: Test
Expand All @@ -31,3 +34,55 @@ jobs:
jvm: 21
- run: scala-cli fmt --check .
- run: scala-cli --power test .

build:
name: Build and push Docker
permissions:
packages: write
runs-on: ubuntu-latest

needs: test

concurrency:
group: cicd-build-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- uses: VirtusLab/scala-cli-setup@v1
with:
jvm: 21
- run: mkdir ./target
- run: scala-cli --power package --standalone . -o ./target/dawn-patrol

- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/dawn-patrol
tags: |
type=sha,prefix=pr-${{ github.event.pull_request.number }}-,priority=601,enable=${{ github.event_name == 'pull_request' }}
type=sha,prefix={{branch}}-,priority=601,enable=${{ github.event_name == 'push' && github.ref_type == 'branch' }}
type=ref,event=branch,priority=600
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=build
type=registry,ref=${{ env.REGISTRY }}/dawn-patrol:latest
cache-to: type=gha,mode=max,scope=build
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM eclipse-temurin:21

WORKDIR /app
COPY ./target/dawn-patrol ./dawn-patrol

ENTRYPOINT [ "/app/dawn-patrol" ]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ Once running, the application will poll the Signal API, obtaining messages for t

The messaging logic is defined in [DawnPatrol](src/xyz/didx/DawnPatrol.scala) and [ConversationPollingHandler](src/xyz/didx/ConversationPollingHandler.scala)

To create a docker container for DawnPatrol use:
### Docker
The easiest way to build a docker container for DawnPatrol is to use the `scala-cli`:

```bash
scala-cli --power package --native --docker . --docker-from ghcr.io/graalvm/jdk-community:21 --docker-image-repository dawn-patrol
scala-cli --power package --docker . --docker-from eclipse-temurin:21 --docker-image-repository dawn-patrol
```

0 comments on commit 67114c3

Please sign in to comment.