Docker #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Build latest docker release | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_URL: https://github.com/${{ github.repository }} | |
ADD_CHROME_VERSION: 120 | |
IMAGE: ulixee/ulixee-cloud | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read version | |
shell: bash | |
working-directory: cloud/main | |
run: export VERSION=$(node -p "require('./package.json').version") && echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Image | |
shell: bash | |
working-directory: cloud/tools/docker | |
run: | | |
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
echo "Building Docker image: ${VERSION}" | |
docker build \ | |
--progress auto \ | |
--cache-from ghcr.io/${IMAGE}:latest \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
\ | |
--build-arg BUILD_DATE=${BUILD_DATE} \ | |
--build-arg GITHUB_SHA=${GITHUB_SHA} \ | |
--build-arg ADD_TO_INSTALL="yarn add "@ulixee/chrome-$ADD_CHROME_VERSION-0"" \ | |
--build-arg VERSION=${VERSION} \ | |
\ | |
--tag ghcr.io/${IMAGE}:v${VERSION} \ | |
--tag ghcr.io/${IMAGE}:latest \ | |
--tag docker.io/${IMAGE}:v${VERSION} \ | |
--tag docker.io/${IMAGE}:latest \ | |
\ | |
--label org.label-schema.build-date=${BUILD_DATE} \ | |
--label org.label-schema.vcs-url=${GITHUB_URL} \ | |
--label org.label-schema.vcs-ref=${GITHUB_SHA} \ | |
\ | |
--label org.opencontainers.image.created=${BUILD_DATE} \ | |
--label org.opencontainers.image.source=${GITHUB_URL} \ | |
--label org.opencontainers.image.revision=${GITHUB_SHA} \ | |
. | |
- name: Push Image to GHCR | |
run: docker push -a ghcr.io/${IMAGE} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Image to Dockerhub | |
run: docker push -a docker.io/${IMAGE} |