Update Docker platforms supports

pull/114/head
Maxim Zalysin 12 months ago
parent 21e3fd8495
commit 0911d55b28

@ -7,8 +7,8 @@ env:
on: on:
push: push:
branches: branches:
- master - master
- v[0-9]+.[0-9]+ - v[0-9]+.[0-9]+
defaults: defaults:
run: run:
@ -22,48 +22,48 @@ jobs:
matrix: matrix:
os: [alpine, debian, ubuntu] os: [alpine, debian, ubuntu]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set environment DOCKERHUB_IMAGE_TAGS on master - name: Set environment DOCKERHUB_IMAGE_TAGS on master
if: github.ref == 'refs/heads/master' && matrix.os == 'alpine' if: github.ref == 'refs/heads/master' && matrix.os == 'alpine'
run: echo "DOCKERHUB_IMAGE_TAGS=$DOCKERHUB_REPOSITORY:latest" >> $GITHUB_ENV run: echo "DOCKERHUB_IMAGE_TAGS=$DOCKERHUB_REPOSITORY:latest" >> $GITHUB_ENV
- name: Set environment DOCKERHUB_IMAGE_TAGS - name: Set environment DOCKERHUB_IMAGE_TAGS
if: github.ref != 'refs/heads/master' if: github.ref != 'refs/heads/master'
run: | run: |
_BRANCH=${GITHUB_REF##*/} _BRANCH=${GITHUB_REF##*/}
_VERSION=${_BRANCH#v*} _VERSION=${_BRANCH#v*}
_MAJOR_VERSION=${_VERSION%.*} _MAJOR_VERSION=${_VERSION%.*}
_DOCKERHUB_IMAGE_TAGS="$DOCKERHUB_REPOSITORY:$_VERSION-${{ matrix.os }}" _DOCKERHUB_IMAGE_TAGS="$DOCKERHUB_REPOSITORY:$_VERSION-${{ matrix.os }}"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION-${{ matrix.os }}" _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION-${{ matrix.os }}"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:${{ matrix.os }}" _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:${{ matrix.os }}"
if [ "${{ matrix.os }}" == "alpine" ]; then if [ "${{ matrix.os }}" == "alpine" ]; then
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_VERSION" _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_VERSION"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION" _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION"
fi fi
echo "DOCKERHUB_IMAGE_TAGS=$_DOCKERHUB_IMAGE_TAGS" >> $GITHUB_ENV echo "DOCKERHUB_IMAGE_TAGS=$_DOCKERHUB_IMAGE_TAGS" >> $GITHUB_ENV
- name: Set environment DOCKERHUB_IMAGE_PLATFORMS - name: Set environment DOCKERHUB_IMAGE_PLATFORMS
run: | run: |
_DOCKERHUB_IMAGE_PLATFORMS="linux/amd64" _DOCKERHUB_IMAGE_PLATFORMS="linux/amd64"
if [ "${{ matrix.os }}" == "debian" ]; then if [ "${{ matrix.os }}" == "debian" ]; then
_DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64" _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64"
elif [ "${{ matrix.os }}" == "ubuntu" ]; then elif [ "${{ matrix.os }}" == "ubuntu" ]; then
_DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm/v7,linux/arm64" _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm/v7,linux/arm64"
fi fi
echo "DOCKERHUB_IMAGE_PLATFORMS=$_DOCKERHUB_IMAGE_PLATFORMS" >> $GITHUB_ENV echo "DOCKERHUB_IMAGE_PLATFORMS=$_DOCKERHUB_IMAGE_PLATFORMS" >> $GITHUB_ENV
- name: Build and push - name: Build and push
if: env.DOCKERHUB_IMAGE_TAGS != '' if: env.DOCKERHUB_IMAGE_TAGS != ''
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
file: Dockerfile.${{ matrix.os }} file: Dockerfile.${{ matrix.os }}
tags: ${{ env.DOCKERHUB_IMAGE_TAGS }} tags: ${{ env.DOCKERHUB_IMAGE_TAGS }}
platforms: ${{ env.DOCKERHUB_IMAGE_PLATFORMS }} platforms: ${{ env.DOCKERHUB_IMAGE_PLATFORMS }}
push: true push: true

@ -1,4 +1,4 @@
FROM alpine:3.17 FROM alpine:3.18
ENV TRACCAR_VERSION 5.8 ENV TRACCAR_VERSION 5.8

@ -24,8 +24,8 @@ Maintainer: [Maxim Zalysin](https://github.com/magna-z)
## Available multi-platform images: ## Available multi-platform images:
**Alpine based**: linux/amd64 **Alpine based**: linux/amd64
**Debian based**: linux/amd64, linux/arm64/v8 **Debian based**: linux/amd64, linux/arm64
**Ubuntu based**: linux/amd64, linux/arm/v7, linux/arm64/v8 **Ubuntu based**: linux/amd64, linux/arm/v7, linux/arm64
## Container create example: ## Container create example:
1. **Create work directories:** 1. **Create work directories:**

Loading…
Cancel
Save