diff --git a/.github/workflows/publish-clementine-dockerhub.yml b/.github/workflows/publish-clementine-dockerhub.yml new file mode 100644 index 00000000..a0769d9a --- /dev/null +++ b/.github/workflows/publish-clementine-dockerhub.yml @@ -0,0 +1,55 @@ +name: Publish Clementine on DockerHub + +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 Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + 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..567e193b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM rust:1.63 as builder +WORKDIR /usr/src/clementine +COPY Cargo.toml ./Cargo.toml +COPY Cargo.lock ./Cargo.lock +COPY src ./src +RUN cargo install --path . + +FROM debian:buster-slim +RUN apt-get update && apt-get install -y libfreetype6 && 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