Build puppeteer Docker image #22
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: build-puppeteer | |
run-name: Build puppeteer Docker image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
tags: | |
- '*' | |
paths: | |
- 'scenarios/**' | |
- 'gunet.js' | |
- 'login.js' | |
- 'Dockerfile' | |
- 'package.json' | |
# Create an env var for the Docker image tag. Use the git tag if available, otherwise the latest | |
env: | |
TAG_NAME: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }} | |
jobs: | |
build-puppeteer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set timezone | |
run: sudo timedatectl set-timezone 'Europe/Athens' | |
- name: Get date | |
id: date | |
run: echo "push_date=$(date '+%H:%M@%d/%m/%Y')" >> $GITHUB_OUTPUT | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Base image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/gunet/puppeteer:latest | |
labels: gr.gunet.puppeteer.latest.pushdate=${{ steps.date.outputs.push_date }} | |
cache-from: type=registry,ref=ghcr.io/gunet/puppeteer:buildcache | |
cache-to: type=registry,ref=ghcr.io/gunet/puppeteer:buildcache,mode=max | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Base image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: gunet/puppeteer:${{ env.TAG_NAME }} | |
labels: gr.gunet.puppeteer.latest.pushdate=${{ steps.date.outputs.push_date }} | |
cache-from: type=registry,ref=gunet/puppeteer:buildcache | |
cache-to: type=registry,ref=gunet/puppeteer:buildcache,mode=max |