Skip to content

Commit

Permalink
Merge branch 'master' into file_formats
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-gomes committed Mar 1, 2024
2 parents 475d742 + c259409 commit 03de3ed
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/dockerx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Push Headless Images
on:
schedule:
- cron: 0 1 * * *
push:
branches-ignore:
- none
workflow_dispatch: null
jobs:
build:
runs-on: linux
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: '${{ secrets.DOCKERHUB_USERNAME }}'
password: '${{ secrets.DOCKERHUB_TOKEN }}'
- name: Set tag name based on branch
id: set_tag
run: |
if [[ "${{ github.ref_name }}" != "master" ]]; then
GITHUB_REFNAME=${{ github.ref_name }}
BRANCH_NAME=${GITHUB_REFNAME//\//_}
echo "tag=-$BRANCH_NAME" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.chromium
platforms: 'linux/amd64,linux/arm/v7,linux/arm64/v8'
push: true
tags: 'hivesolutions/headless:chromium${{ steps.set_tag.outputs.tag }}'
33 changes: 33 additions & 0 deletions Dockerfile.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:18-bookworm-slim as builder

ADD app.js /app/
ADD package.json /app/
ADD lib /app/lib

WORKDIR /app

RUN NODE_ENV=production PUPPETEER_SKIP_CHROME_DOWNLOAD=false npm install

FROM node:18-bookworm-slim

LABEL version="1.0"
LABEL maintainer="Hive Solutions <development@hive.pt>"

RUN DEBIAN_FRONTEND=noninteractive apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y fonts-arphic-uming\
fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf\
fonts-ipafont-gothic fonts-liberation fonts-noto-cjk fonts-noto-color-emoji\
fonts-arphic-ukai ttf-wqy-zenhei ttf-wqy-microhei libxss1 dbus dbus-x11\
fontconfig chromium --no-install-recommends &&\
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && apt-get clean &&\
rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt

ENV HOST 0.0.0.0
ENV PORT 8080
ENV NODE_ENV production
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium

COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app /app

CMD ["/usr/local/bin/node", "/app/app.js"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ Simple headless browser API to render images (PNG, JPEG, WebP, TIFF, BMP, etc.)
| -------------- | ----- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
| `HEADLESS_KEY` | `str` | `None` | Secret key that should be passed in protected calls so that the server-side "trusts" the client side (authentication). |

## Docker Images

Headless is available on [Docker Hub](https://hub.docker.com/r/hivesolutions/headless) with the following tags:

| Tag | Description | Supported Architectures |
| ---------- | -------------------------------------------------- | ----------------------------- |
| `latest` | The most up-to-date stable version. | `amd64` |
| `debian` | Debian-based container for stability and security. | `amd64` |
| `chromium` | Container using chromium instead of chrome. | `amd64`, `arm/v7`, `arm64/v8` |

## License

Headless is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
Expand All @@ -23,3 +33,4 @@ Headless is currently licensed under the [Apache License, Version 2.0](http://ww
[![Build Status GitHub](https://github.com/hivesolutions/headless/workflows/Main%20Workflow/badge.svg)](https://github.com/hivesolutions/headless/actions)
[![npm Status](https://img.shields.io/npm/v/hive-headless.svg)](https://www.npmjs.com/package/hive-headless)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://www.apache.org/licenses/)

0 comments on commit 03de3ed

Please sign in to comment.