-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: include dist files into the github release * chore: fix build in ci script * chore: login to quay.io and docker-hub * chore: fix workflow issue * chore: push container images to remove registries * chore: list current directory * chore: checkout code before any action * fix: fix issue with the build image * chore: code cleanup * chore: update actions version * chore: format branch tag name to confront to docker image tag names * feat: add container image * fix: fix docker file path * chore: test push * chore: only push docker images on master and next branches * chore: code cleanup * chore: update docker hub descrption * chore: update bug template * docs: update badges * chore: only build docker image if the web service changes * only update docker read-me in master branches Co-authored-by: Ivan Vilanculo <[email protected]>
- Loading branch information
Showing
11 changed files
with
179 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: container-images | ||
|
||
on: | ||
push: | ||
branches: [master, next] | ||
paths: [packages/service, "!**/*.md"] | ||
pull_request: | ||
branches: [master, next] | ||
paths: [packages/service, "!**/*.md"] | ||
|
||
jobs: | ||
container-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
|
||
- name: Read container image tags | ||
id: image-tags | ||
run: | | ||
echo "VERSION=$(cat packages/service/package.json | jq .version -r)" >> $GITHUB_OUTPUT | ||
echo "BRANCH=$(echo "${{ github.head_ref || github.ref_name }}" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)" >> $GITHUB_OUTPUT | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: packages/service/Dockerfile | ||
tags: | ||
isneezy/pdf-generator:${{ steps.image-tags.outputs.VERSION }}, | ||
isneezy/pdf-generator:${{ steps.image-tags.outputs.BRANCH }}, | ||
isneezy/pdf-generator:latest, | ||
|
||
isneezy/pdf-generator-service:${{ steps.image-tags.outputs.VERSION }}, | ||
isneezy/pdf-generator-service:${{ steps.image-tags.outputs.BRANCH }}, | ||
isneezy/pdf-generator-service:latest, | ||
|
||
quay.io/isneezy/pdf-generator-service:${{ steps.image-tags.outputs.VERSION }}, | ||
quay.io/isneezy/pdf-generator-service:${{ steps.image-tags.outputs.BRANCH }}, | ||
quay.io/isneezy/pdf-generator-service:latest, | ||
push: ${{ (contains(github.ref, 'master') || contains(github.ref, 'next')) }} | ||
|
||
- name: Update legacy Docker Hub Description | ||
if: ${{ (contains(github.ref, 'master') }} | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: isneezy/pdf-generator | ||
short-description: 'A simple and yet powerful, versatile web service for converting HTML pages, templates, and URLs into high-quality PDF documents.' | ||
readme-filepath: packages/service/README.md | ||
|
||
- name: Update Docker Hub Description | ||
if: ${{ (contains(github.ref, 'master') }} | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: isneezy/pdf-generator-service | ||
short-description: 'A simple and yet powerful, versatile web service for converting HTML pages, templates, and URLs into high-quality PDF documents.' | ||
readme-filepath: packages/service/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
FROM node:lts-alpine3.12 AS base | ||
|
||
# Installs latest Chromium package. | ||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories \ | ||
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | ||
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ | ||
&& echo "http://dl-cdn.alpinelinux.org/alpine/v3.11/main" >> /etc/apk/repositories \ | ||
&& apk upgrade -U -a \ | ||
&& apk add --no-cache \ | ||
libstdc++ \ | ||
chromium \ | ||
harfbuzz \ | ||
nss \ | ||
freetype \ | ||
ttf-freefont \ | ||
&& rm -rf /var/cache/* \ | ||
&& mkdir /var/cache/apk | ||
|
||
# Add Chrome as a user | ||
RUN mkdir -p /app \ | ||
&& adduser -D chrome \ | ||
&& chown -R chrome:chrome /app | ||
|
||
# Run Chrome as non-privileged | ||
USER chrome | ||
WORKDIR /app | ||
|
||
ENV CHROME_BIN=/usr/bin/chromium-browser \ | ||
CHROME_PATH=/usr/lib/chromium/ \ | ||
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \ | ||
PUPPETEER_ARGS='--no-sandbox --disable-setuid-sandbox' \ | ||
PUPPETEER_PREVENT_INTERNAL_CHROMIUM='yes' \ | ||
PUPPETEER_SKIP_DOWNLOAD='yes' | ||
|
||
FROM base AS builder | ||
|
||
COPY --chown=chrome:chrome package.json . | ||
COPY --chown=chrome:chrome packages/service/package.json ./packages/service/package.json | ||
COPY --chown=chrome:chrome packages/library/package.json ./packages/library/package.json | ||
|
||
COPY --chown=chrome:chrome yarn.lock . | ||
COPY --chown=chrome:chrome packages/service/package.json ./packages/service/yarn.lock | ||
COPY --chown=chrome:chrome packages/library/package.json ./packages/library/yarn.lock | ||
|
||
RUN yarn install --check-files --frozen-lockfile --non-interactive && yarn cache dir | ||
|
||
COPY --chown=chrome:chrome . . | ||
|
||
# Test and build | ||
RUN CI=true yarn test && yarn build | ||
|
||
FROM base | ||
COPY --chown=chrome:chrome package.json . | ||
COPY --chown=chrome:chrome packages/service/package.json ./packages/service/package.json | ||
COPY --chown=chrome:chrome packages/library/package.json ./packages/library/package.json | ||
|
||
COPY --chown=chrome:chrome yarn.lock . | ||
COPY --chown=chrome:chrome packages/service/package.json ./packages/service/yarn.lock | ||
COPY --chown=chrome:chrome packages/library/package.json ./packages/library/yarn.lock | ||
|
||
RUN yarn install --production && yarn cache clean && chown -R chrome:chrome ./ | ||
|
||
COPY --from=builder --chown=chrome:chrome /app/packages/library/dist ./packages/library/dist | ||
COPY --from=builder --chown=chrome:chrome /app/packages/service/dist ./packages/service/dist | ||
|
||
EXPOSE 3000 | ||
CMD ["node", "packages/service/dist/src/pdf-generator-service.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters