Skip to content

Commit

Permalink
Merge pull request #8 from ScientaNL/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
HarmenM authored Feb 9, 2021
2 parents 9ed6295 + 146fffa commit a8c06a3
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 26 deletions.
23 changes: 0 additions & 23 deletions .drone.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and push docker image for branch or tag
on:
release:
types: [ created ]
push:
branches: ['**']
jobs:
build-html-pdf-export-container:
name: Build html-pdf-export container
runs-on: ubuntu-latest
if: github.repository == 'ScientaNL/html-pdf-export'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set Github environment variables
uses: ScientaNL/github-actions-env-toolkit@1.0.0

- name: Checkout repository
uses: actions/checkout@v2

- name: DockerHub Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_PUBLIC_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUBLIC_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build & push Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: scienta/html-pdf-export:${{ github.event_name == 'push' && 'branch-' || '' }}${{env.GITHUB_REF_NAME_SLUG}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUN apk add --update --no-cache \
libxrender \
libxext \
libintl \
libcrypto1.0 \
libssl1.0 \
libcrypto1.1 \
libssl1.1 \
ttf-opensans

# We use a pre-compiled version of wkhtmltopdf because there are no Alpine binaries available on https://wkhtmltopdf.org/downloads.html
Expand All @@ -23,4 +23,4 @@ RUN chmod -R 777 /usr/bin/wkhtmltopdf
COPY index.js .

EXPOSE 8000
CMD ["node", "index.js"]
CMD ["node", "index.js"]

0 comments on commit a8c06a3

Please sign in to comment.