diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..da02064 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,38 @@ +name: "Build and Publish Docker Image" + +on: + push: + paths: + - "Dockerfile" # Trigger only when the Dockerfile is modified + +env: + IMAGE_NAME: ghcr.io/${{ github.repository }}:${{ github.sha }} # Image name with SHA tag + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker Image + run: | + docker build -t $IMAGE_NAME . + + - name: Push Docker Image to GitHub Container Registry + run: | + docker push $IMAGE_NAME + + - name: Tag as Latest (optional) + if: github.ref == 'refs/heads/main' # Only tag as 'latest' on the main branch + run: | + docker tag $IMAGE_NAME ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6277fcd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use Fedora as the base image +FROM fedora:latest + +# Install the required packages +RUN dnf install -y \ + flatpak \ + flatpak-builder \ + p7zip \ + xmlstarlet \ + bzip2 \ + curl \ + jq && \ + dnf clean all + +# Add flathub and flathub-beta remotes for flatpak +RUN flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \ + flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo + +# Set default command (optional, for testing purposes) +CMD [ "flatpak builder" ] \ No newline at end of file