mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-12 20:25:06 +01:00
build: add major version tag for docker images
merge pull request #260 from dumbmoron/docker-major-version
This commit is contained in:
commit
3ee6cdef5b
2 changed files with 13 additions and 11 deletions
18
.github/workflows/docker.yml
vendored
18
.github/workflows/docker.yml
vendored
|
@ -29,20 +29,22 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get version from package.json
|
- name: Get release metadata
|
||||||
id: package-version
|
id: release-meta
|
||||||
uses: martinbeentjes/npm-get-version-action@v1.3.1
|
run: |
|
||||||
- name: Get short commit hash
|
version=$(cat package.json | jq -r .version)
|
||||||
id: commit-hash
|
echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
run: echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
echo "major_version=$(echo "$version" | cut -d. -f1)" >> $GITHUB_OUTPUT
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
type=raw,value=${{ steps.package-version.outputs.current-version }}
|
type=raw,value=${{ steps.release-meta.outputs.version }}
|
||||||
type=raw,value=${{ steps.package-version.outputs.current-version }}-${{ steps.commit-hash.outputs.commit_short }}
|
type=raw,value=${{ steps.release-meta.outputs.major_version }}
|
||||||
|
type=raw,value=${{ steps.release-meta.outputs.version }}-${{ steps.release-meta.outputs.commit_short }}
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
|
|
@ -2,7 +2,7 @@ version: '3.5'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
cobalt-api:
|
cobalt-api:
|
||||||
image: ghcr.io/wukko/cobalt:latest
|
image: ghcr.io/wukko/cobalt:7
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
container_name: cobalt-api
|
container_name: cobalt-api
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ services:
|
||||||
#- ./cookies.json:/cookies.json
|
#- ./cookies.json:/cookies.json
|
||||||
|
|
||||||
cobalt-web:
|
cobalt-web:
|
||||||
image: ghcr.io/wukko/cobalt:latest
|
image: ghcr.io/wukko/cobalt:7
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
container_name: cobalt-web
|
container_name: cobalt-web
|
||||||
|
|
||||||
|
@ -61,4 +61,4 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: --cleanup --scope cobalt --interval 900
|
command: --cleanup --scope cobalt --interval 900
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
Loading…
Reference in a new issue