Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added workflow for building and pushing containers from docker/auxili… #394

Merged
merged 8 commits into from
Sep 1, 2023
36 changes: 36 additions & 0 deletions .github/workflows/build-and-push-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Push Containers
on:
pull_request:
types:
- closed
paths:
- 'docker/auxiliary-containers/**/Dockerfile'

workflow_dispatch:

jobs:
build-and-push-containers:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3

## This is needed for multi-architecture builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Containers
run: bash ./docker/auxiliary-containers/build-containers.sh
18 changes: 18 additions & 0 deletions docker/auxiliary-containers/build-containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

# The names of the folders within "auxiliary-containers" must match the repository name in dockerhub!

# Get the list of subdirectories within "auxiliary-containers" directory containing a Dockerfile
subdirs=($(find ./docker/auxiliary-containers -type f -name 'Dockerfile' -exec dirname {} \;))

# Loop through each subdirectory, build and push the Docker image
for subdir in "${subdirs[@]}"; do
folder=$(basename "${subdir}")
docker buildx build \
--push \
--tag "greencoding/${folder}:latest" \
--platform linux/amd64,linux/arm64 \
"${subdir}"
done
13 changes: 13 additions & 0 deletions docker/auxiliary-containers/gcb_playwright/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/playwright/python:v1.35.0-jammy

# Install dependencies
RUN apt-get update && apt-get install -y curl wget gnupg && rm -rf /var/lib/apt/lists/*

# Install Playwright
RUN pip install playwright==1.35.0

# Set up Playwright dependencies for Chromium, Firefox and Webkit
RUN playwright install
RUN playwright install-deps

CMD ["/bin/bash"]
Loading