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

Add docker image #550

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/docker.yml
@@ -0,0 +1,53 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Create and publish a Docker image

on:
push:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
tmaier marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
39 changes: 39 additions & 0 deletions Dockerfile
@@ -0,0 +1,39 @@
FROM node:20-slim

ARG CRITICAL_VERSION=5.0.4

ARG PACKAGES="\
libx11-6\
libx11-xcb1\
libxcomposite1\
libxcursor1\
libxdamage1\
libxext6\
libxi6\
libxtst6\
libglib2.0-0\
libnss3\
libcups2\
libxss1\
libexpat1\
libxrandr2\
libasound2\
libatk1.0-0\
libatk-bridge2.0-0\
libpangocairo-1.0-0\
libgtk-3-0\
"
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
# hadolint ignore=DL3008
RUN --mount=type=cache,id=build-apt-cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=build-apt-lib,sharing=locked,target=/var/lib/apt \
apt-get update -qq \
&& apt-get install --no-install-recommends -y ${PACKAGES} \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

RUN --mount=type=cache,id=build-npm-cache,sharing=locked,target=/root/.npm \
npm install -g critical@${CRITICAL_VERSION}

WORKDIR /site

CMD ["critical", "--help"]