diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml new file mode 100644 index 00000000..96432c70 --- /dev/null +++ b/.github/workflows/publish-ghcr.yml @@ -0,0 +1,55 @@ +name: Publish Clementine on GHCR + +on: + push: + branches: + - 'main' + - 'develop' + tags: + - 'v*' + paths: + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + pull_request: + branches: + - 'main' + paths: + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + push_clementine_to_registry: + name: Push Clementine image to GHCR + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to GHCR + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..79b403f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.63 as builder +WORKDIR /usr/src/clementine +COPY . . +RUN cargo install --path . + +FROM debian:bullseye-slim +RUN apt-get update && apt-get install -y libfreetype6 libfontconfig1-dev && rm -rf /var/lib/apt/lists/* +COPY --from=builder /usr/local/cargo/bin/clementine /usr/local/bin/clementine +ENTRYPOINT ["clementine"] \ No newline at end of file