Skip to content

Commit b293be4

Browse files
tmaieradonyssantos
andauthored
Add docker image (#550)
* Add docker image * Ignore hadolint warning Ref. https://github.com/hadolint/hadolint/wiki/DL3008 * Fix CMD * Update .github/workflows/docker.yml Co-authored-by: Adonys Santos <[email protected]> * Set node version to 20 --------- Co-authored-by: Adonys Santos <[email protected]>
1 parent b326606 commit b293be4

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

.github/workflows/docker.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Create and publish a Docker image
11+
12+
on:
13+
push:
14+
branches:
15+
- master
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
build-and-push-image:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Log in to the Container registry
35+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
49+
with:
50+
context: .
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM node:20-slim
2+
3+
ARG CRITICAL_VERSION=5.0.4
4+
5+
ARG PACKAGES="\
6+
libx11-6\
7+
libx11-xcb1\
8+
libxcomposite1\
9+
libxcursor1\
10+
libxdamage1\
11+
libxext6\
12+
libxi6\
13+
libxtst6\
14+
libglib2.0-0\
15+
libnss3\
16+
libcups2\
17+
libxss1\
18+
libexpat1\
19+
libxrandr2\
20+
libasound2\
21+
libatk1.0-0\
22+
libatk-bridge2.0-0\
23+
libpangocairo-1.0-0\
24+
libgtk-3-0\
25+
"
26+
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
27+
# hadolint ignore=DL3008
28+
RUN --mount=type=cache,id=build-apt-cache,sharing=locked,target=/var/cache/apt \
29+
--mount=type=cache,id=build-apt-lib,sharing=locked,target=/var/lib/apt \
30+
apt-get update -qq \
31+
&& apt-get install --no-install-recommends -y ${PACKAGES} \
32+
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
33+
34+
RUN --mount=type=cache,id=build-npm-cache,sharing=locked,target=/root/.npm \
35+
npm install -g critical@${CRITICAL_VERSION}
36+
37+
WORKDIR /site
38+
39+
CMD ["critical", "--help"]

0 commit comments

Comments
 (0)