提交 77d902bb 编写于 作者: M Markus Pöschl

Change the actions to build both of the versioned variants

上级 281382c0
......@@ -33,27 +33,30 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-${{ env.NODE_ENV }}
- name: Configure ENVs
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE || env.DEFAULT_DOCKER_IMAGE }}
DOCKERFILE: ${{ env.NODE_ENV == 'prod' && './docker-files/Dockerfile' || './docker-files/dev.Dockerfile' }}
- name: Configure
id: config
run: |
ls -la /tmp/.buildx-cache || true
VERSION=latest
DEFAULT_TAGET='minimal'
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
DEFAULT_TAG="${VERSION}"s
FULL_TAG="${VERSION}-full"
if [[ $GITHUB_REF == refs/heads/develop ]]; then
elif [[ $GITHUB_REF == refs/heads/develop ]]; then
VERSION=dev
DEFAULT_TAG="${VERSION}"
DEFAULT_TAGET='dev'
else
VERSION=latest
DEFAULT_TAG="${VERSION}"
fi
echo "DOCKERFILE=${DOCKERFILE}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAGS=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_ENV
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
echo "VCS_REF=${GITHUB_SHA::8}" >> $GITHUB_ENV
echo "::set-output name=defaultTag::$DEFAULT_TAG"
echo "::set-output name=fullTag::$FULL_TAG"
echo "::set-output name=defaultTarget::$DEFAULT_TAGET"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
......@@ -73,17 +76,31 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
- name: Build and push minimal image
uses: docker/build-push-action@v2
with:
push: ${{ env.PUSH_BRANCH == 'true' }}
tags: ${{ steps.config.outputs.defaultTag }}
build-args: |
ACTION_ID=${{env.GITHUB_ACTION}}
context: .
file: docker-files/debian.Dockerfile
platforms: ${{env.DOCKER_PLATFORMS}}
target: ${{ steps.config.outputs.defaultTarget }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- name: Build and push full image
if: ${{ steps.config.outputs.fullTag != '' }}
uses: docker/build-push-action@v2
with:
push: ${{ env.PUSH_BRANCH == 'true' }}
tags: ${{env.TAGS}}
tags: ${{ steps.config.outputs.fullTag }}
build-args: |
VERSION=${{env.VERSION}}
BUILD_DATE=${{env.BUILD_DATE}}
VCS_REF=${{env.VCS_REF}}
ACTION_ID=${{env.GITHUB_ACTION}}
context: .
file: ${{env.DOCKERFILE}}
file: docker-files/debian.Dockerfile
target: full
platforms: ${{env.DOCKER_PLATFORMS}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
......@@ -122,4 +139,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
\ No newline at end of file
password: ${{ secrets.PYPI_API_TOKEN }}
......@@ -4,8 +4,7 @@
# https://github.com/nicolargo/glances
#
ARG ARCH
FROM ${ARCH}python:3.9-slim-buster as build
FROM python:3.9-slim-buster as build
# Install package
RUN apt-get update && \
......@@ -21,7 +20,7 @@ RUN apt-get update && \
FROM build as remoteInstall
# Force rebuild otherwise it could be cached without rerun
ARG VCS_REF
ARG ACTION_ID
RUN pip3 install --no-cache-dir --user glances[all]
......@@ -45,7 +44,7 @@ CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT
#Create running images without any building dependency
FROM ${ARCH}python:3.9-slim-buster as minimal
FROM python:3.9-slim-buster as minimal
RUN apt-get update && \
apt-get install -y --no-install-recommends \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册