mirror of
https://github.com/GeopJr/BLAHAJ.git
synced 2025-01-22 08:36:30 +01:00
feat: Docker Support 🐳 (#11)
* feat: added dockerfile and relvant docs * feat: added ci to publish docker images * chore: bumped all checkout actions to v4 * chore: removed unnecessary deps from build stage * chore: changed build targets to amd64 and arm64 only * chore: moved docker publish logic to push trigger Switched the docker image build/publish pipeline event to a push event on either a `v*` tag or to the main branch. * fix: README * feat: publish => docker * feat: dont run on main push lets only publish releases instead --------- Co-authored-by: Evangelos Paterakis <evan@geopjr.dev>
This commit is contained in:
parent
ee238d833f
commit
c3b1707bdb
5 changed files with 67 additions and 4 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -5,7 +5,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Crystal
|
||||
uses: crystal-lang/install-crystal@v1
|
||||
- name: Install shards
|
||||
|
|
45
.github/workflows/docker.yml
vendored
Normal file
45
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
publish-docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Container Metadata
|
||||
id: metadata
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ github.repository_owner }}/blahaj
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
- name: Build and Push Container
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
|
@ -1,5 +1,7 @@
|
|||
name: Release
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build_linux_static:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -7,10 +9,10 @@ jobs:
|
|||
image: crystallang/crystal:latest-alpine
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
- name: Retrieve version
|
||||
run: |
|
||||
echo "::set-output name=VERSION::$(shards version)"
|
||||
echo "VERSION=$(shards version)" >> "$GITHUB_OUTPUT"
|
||||
id: version
|
||||
- name: Build
|
||||
run: make static_mt
|
||||
|
@ -26,7 +28,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: build_linux_static
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: ./GH_ARTIFACTS
|
||||
|
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
|||
FROM --platform=linux/amd64 crystallang/crystal:latest-alpine as builder
|
||||
|
||||
WORKDIR /root/src
|
||||
COPY . .
|
||||
RUN shards build --production --no-debug --release -Dpreview_mt --static
|
||||
|
||||
|
||||
FROM scratch
|
||||
COPY --from=builder /root/src/bin/blahaj /usr/local/bin/blahaj
|
||||
ENTRYPOINT [ "blahaj" ]
|
|
@ -32,6 +32,12 @@ They are built & published by our lovely [actions](https://github.com/GeopJr/BLA
|
|||
|
||||
Arch Linux users can install the [blahaj](https://aur.archlinux.org/packages/blahaj) (or the [blahaj-git](https://aur.archlinux.org/packages/blahaj-git)) AUR package.
|
||||
|
||||
### Docker
|
||||
|
||||
```
|
||||
docker run --rm -it --name blahaj ghcr.io/geopjr/blahaj -h
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
#### Dependencies
|
||||
|
|
Loading…
Reference in a new issue