Build and push to ghcr

Adds a GitHub Actions job that builds and pushes docker image to GitHub
Container Registry.

Image tags and labels are managed by the default strategy of
https://github.com/docker/metadata-action#basic action.

Also browser and driver versions are updated to the latest.
This commit is contained in:
Martynas Mickevičius 2022-03-18 07:46:35 +02:00
parent 46c77076ab
commit 64358ff2e5
No known key found for this signature in database
GPG Key ID: E735DF276C508071
2 changed files with 46 additions and 2 deletions

44
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Docker Image
on:
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
jobs:
build-and-push-docker-image:
name: Build Docker image and push to repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v2
with:
file: ./docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

View File

@ -6,7 +6,7 @@ RUN apt-get update
RUN apt-get install -y libgconf-2-4 wget xvfb unzip RUN apt-get install -y libgconf-2-4 wget xvfb unzip
# Install Chrome (compatible version with chromedriver below) # Install Chrome (compatible version with chromedriver below)
ARG CHROME_VERSION="87.0.4280.141-1" ARG CHROME_VERSION="99.0.4844.74-1"
RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \ RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
&& apt install -y /tmp/chrome.deb \ && apt install -y /tmp/chrome.deb \
&& rm /tmp/chrome.deb && rm /tmp/chrome.deb
@ -14,7 +14,7 @@ RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/
# RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb # RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install # RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
# Set up Chromedriver Environment variables # Set up Chromedriver Environment variables
ENV CHROMEDRIVER_VERSION 87.0.4280.88 ENV CHROMEDRIVER_VERSION 99.0.4844.51
ENV CHROMEDRIVER_DIR /chromedriver ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR RUN mkdir $CHROMEDRIVER_DIR
# Download and install Chromedriver # Download and install Chromedriver