Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 64 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,73 @@ name: Node.js CI

on:
push:
branches: [main]
branches: [chromium-patch-1, main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

build_arms:

runs-on: ubuntu-20.04
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}

strategy:
matrix:
include:
- arch: aarch64
distro: ubuntu20.04

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: uraimo/run-on-arch-action@v2
name: Build artifact
id: build
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
githubToken: ${{ github.token }}
run: |
uname -a
# echo ::set-output name=uname::$(uname -a)

- 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: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
permissions:
contents: read
packages: write
Expand All @@ -20,6 +77,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

# - name: Display current branch
# run: echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
Expand All @@ -37,6 +97,6 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
32 changes: 25 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
FROM node:19
WORKDIR /app
ARG TARGETPLATFORM

RUN echo "Building for $TARGETPLATFORM"

COPY debian-stable.list /tmp

# We don't need the standalone Chromium
RUN apt-get install -y wget \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update && apt-get -y install google-chrome-stable chromium xvfb\
&& rm -rf /var/lib/apt/lists/* \
&& echo "Chrome: " && google-chrome --version
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
apt-get install -y wget curl gnupg \
&& cp /tmp/debian-stable.list /etc/apt/sources.list.d/ \
&& apt-get update && apt-get -y install chromium xvfb \
&& echo "Chrome: " && chromium --version \
&& ln -s /usr/bin/chromium /usr/bin/google-chrome-stable \
else \
apt-get install -y wget \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update && apt-get -y install google-chrome-stable chromium xvfb\
&& echo "Chrome: " && google-chrome --version ; \
fi

# Remove tmp file
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /tmp/debian-stable.list

COPY package.json .
COPY package-lock.json .
RUN npm install
COPY . .
RUN npm run build
EXPOSE 4000
CMD npx prisma migrate deploy && xvfb-run --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR -maxclients 2048" node dist/index.js
CMD npx prisma migrate deploy && xvfb-run --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR -maxclients 2048" node dist/index.js
8 changes: 8 additions & 0 deletions debian-stable.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable main
deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable main

deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian-security/ stable-security main
deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian-security/ stable-security main

deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable-updates main
deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable-updates main