Skip to content

Commit

Permalink
feat: Prebuilt Docker Image
Browse files Browse the repository at this point in the history
  • Loading branch information
nyaruta authored Jun 6, 2024
1 parent 7fe0b4a commit 5bd625b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 8 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}


jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

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

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

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=ref,event=tag
type=sha
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM nikolaik/python-nodejs:python3.8-nodejs12 AS builder
FROM node:20-alpine3.16

ENV NODE_WORKDIR /app
WORKDIR $NODE_WORKDIR
WORKDIR /app
ADD . /app

ADD . $NODE_WORKDIR
RUN apk add gcompat libstdc++ libuuid vips-dev build-base jpeg-dev pango-dev cairo-dev imagemagick libssl1.1 --no-cache&& \
ln -s /lib/libresolv.so.2 /usr/lib/libresolv.so.2
RUN npm install

RUN apt-get update && apt-get install -y build-essential gcc wget git libvips && rm -rf /var/lib/apt/lists/*


RUN npm install [email protected] && npm install # TODO: canvas crashes if installed via npm install from package.json
CMD ["index.js"]

0 comments on commit 5bd625b

Please sign in to comment.