Skip to content

Commit

Permalink
RIP-Comm#59 added Dockerfile and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mastrogiovanni committed Sep 24, 2022
1 parent 1ce8796 commit f8ff85e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/publish-clementine-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit f8ff85e

Please sign in to comment.