mirror of
https://github.com/Steffo99/distributed-arcade.git
synced 2024-11-21 23:54:25 +00:00
Create Dockerfile and Actions workflow
This commit is contained in:
parent
d8c3397e3b
commit
3eab068e04
2 changed files with 76 additions and 0 deletions
53
.github/workflows/docker.yml
vendored
Normal file
53
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
name: "Automated release"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-docker:
|
||||||
|
name: "Build and publish Docker image on ghcr.io"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout repository"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "Find the release semantic version"
|
||||||
|
id: "semver"
|
||||||
|
uses: "Steffo99/actions-semver@v0.3.4"
|
||||||
|
with:
|
||||||
|
string: "${{ github.ref_name }}"
|
||||||
|
|
||||||
|
- name: "Setup Buildx"
|
||||||
|
uses: "docker/setup-buildx-action@v2"
|
||||||
|
|
||||||
|
- name: "Login to GitHub Containers"
|
||||||
|
uses: "docker/login-action@v2"
|
||||||
|
with:
|
||||||
|
registry: "ghcr.io"
|
||||||
|
username: "${{ github.repository_owner }}"
|
||||||
|
password: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
||||||
|
- name: "Find the lowercase name of the repository"
|
||||||
|
id: "reponame"
|
||||||
|
uses: "ASzc/change-string-case-action@v2"
|
||||||
|
with:
|
||||||
|
string: "${{ github.repository }}"
|
||||||
|
|
||||||
|
- name: "Build and push the Docker image"
|
||||||
|
uses: "docker/build-push-action@v3"
|
||||||
|
with:
|
||||||
|
tags: >-
|
||||||
|
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.precedence }},
|
||||||
|
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.core }},
|
||||||
|
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.pair }},
|
||||||
|
ghcr.io/${{ steps.reponame.outputs.lowercase }}:${{ steps.semver.outputs.major }},
|
||||||
|
ghcr.io/${{ steps.reponame.outputs.lowercase }}:latest
|
||||||
|
push: true
|
||||||
|
|
||||||
|
- name: "Create release"
|
||||||
|
uses: "ncipollo/release-action@v1.10.0"
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
generateReleaseNotes: true
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM rust:1.65 AS labels
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.title="Distributed Arcade"
|
||||||
|
LABEL org.opencontainers.image.description="Fast and simple scoreboard service for games"
|
||||||
|
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
|
||||||
|
LABEL org.opencontainers.image.url="https://github.com/Steffo99/distributed-arcade"
|
||||||
|
LABEL org.opencontainers.image.authors="Stefano Pigozzi <me@steffo.eu>"
|
||||||
|
|
||||||
|
|
||||||
|
FROM labels AS files
|
||||||
|
|
||||||
|
WORKDIR /usr/src/distributed_arcade
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
|
||||||
|
FROM files AS install
|
||||||
|
|
||||||
|
RUN cargo install --path . --all-features --bins
|
||||||
|
|
||||||
|
|
||||||
|
FROM install AS environment
|
||||||
|
|
||||||
|
ENV RUST_LOG "warn,distributed_arcade=info"
|
Loading…
Reference in a new issue