Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
examples/assets
19 changes: 18 additions & 1 deletion .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: CI

on:
push:
Expand Down Expand Up @@ -72,6 +72,7 @@ jobs:
cache: "npm"
cache-dependency-path: ./package.json
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm run test
- uses: actions/upload-artifact@v4
Expand All @@ -80,3 +81,19 @@ jobs:
path: editly-out.mp4
compression-level: 0
if-no-files-found: error
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: mifi/editly-assets
path: examples/assets
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodejs }}
cache: "npm"
cache-dependency-path: ./package.json
- run: docker compose build
- run: docker compose up -d
- run: docker compose run editly bash -c "cd examples && ./run audio1.json5"
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "yarn"
cache: "npm"
cache-dependency-path: ./package.json
- run: yarn install
- run: npm install && npm run build
- run: |
cd examples
./run "${{ matrix.example }}"
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
branches:
- "master"
tags:
- "v*"

jobs:
docker:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: editly/editly
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
107 changes: 57 additions & 50 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@
FROM jrottenberg/ffmpeg:4.3.1-ubuntu1804
FROM node:lts-bookworm AS build

# Install dependencies for building canvas/gl
RUN apt-get update -y

RUN apt-get -y install \
build-essential \
libcairo2-dev \
libgif-dev \
libgl1-mesa-dev \
libglew-dev \
libglu1-mesa-dev \
libjpeg-dev \
libpango1.0-dev \
librsvg2-dev \
libxi-dev \
pkg-config \
python-is-python3

WORKDIR /app

# Ensures tzinfo doesn't ask for region info.
ENV DEBIAN_FRONTEND noninteractive

## INSTALL NODE VIA NVM

RUN apt-get update && apt-get install -y \
dumb-init \
xvfb

# Source: https://gist.github.com/remarkablemark/aacf14c29b3f01d6900d13137b21db3a
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# update the repository sources list
# and install dependencies
RUN apt-get update \
&& apt-get install -y curl \
&& apt-get -y autoclean

# nvm environment variables
ENV NVM_VERSION 0.37.2
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14.4.0

# install nvm
# https://github.com/creationix/nvm#install-script
RUN mkdir -p $NVM_DIR \
&& curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | bash

# install node and npm
RUN source ${NVM_DIR}/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default

# add node and npm to path so the commands are available
ENV NODE_PATH ${NVM_DIR}/v${NODE_VERSION}/lib/node_modules
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin:$PATH

# confirm installation
RUN node -v
RUN npm -v

## INSTALL EDITLY

# ## Install app dependencies
COPY package.json /app/
RUN npm install
# Install node dependencies
COPY package.json ./
RUN npm install --no-fund --no-audit

# Add app source
COPY . /app
COPY . .

# Build TypeScript
RUN npm run build

# Prune dev dependencies
RUN npm prune --omit=dev

# Purge build dependencies
RUN apt-get --purge autoremove -y \
build-essential \
libcairo2-dev \
libgif-dev \
libgl1-mesa-dev \
libglew-dev \
libglu1-mesa-dev \
libjpeg-dev \
libpango1.0-dev \
librsvg2-dev \
libxi-dev \
pkg-config \
python-is-python3

# Remove Apt cache
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Final stage for app image
FROM node:lts-bookworm

# Install runtime dependencies
RUN apt-get update -y \
&& apt-get -y install ffmpeg dumb-init xvfb libcairo2 libpango1.0 libgif7 librsvg2-2 \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

WORKDIR /app
COPY --from=build /app /app

# Ensure `editly` binary available in container
RUN npm link
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
editly:
container_name: editly
Expand All @@ -9,6 +7,7 @@ services:
dockerfile: Dockerfile
volumes:
- "outputs:/outputs"
- ./examples/assets/:/app/examples/assets/

volumes:
outputs:
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ How to run examples:
git clone https://github.com/mifi/editly.git
cd editly
npm install
npm run build
cd examples
git clone https://github.com/mifi/editly-assets.git assets
./run commonFeatures.json5
Expand Down
2 changes: 1 addition & 1 deletion examples/customFabric.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import editly from 'editly';
import { CustomFabricFunctionArgs, CustomFabricFunctionCallbacks } from '../dist/index.js';
import type { CustomFabricFunctionArgs, CustomFabricFunctionCallbacks } from 'editly';

function func({ width, height, fabric }: CustomFabricFunctionArgs): CustomFabricFunctionCallbacks {
return {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"p-map": "^7.0.2"
},
"scripts": {
"prepare": "pkgroll --clean-dist --sourcemap",
"build": "pkgroll --clean-dist --sourcemap",
"prepublishOnly": "npm run build",
"test": "tsx test/index.ts",
"lint": "eslint ."
},
Expand Down
3 changes: 1 addition & 2 deletions src/sources/fabric.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fabric from 'fabric/node';
import { type CanvasRenderingContext2D, createCanvas, ImageData } from 'canvas';
import { boxBlurImage } from '../BoxBlur.js';
import type { CreateFrameSourceOptions, FrameSource, CanvasLayer, CustomFabricFunctionCallbacks, Layer } from '../types.js';
import { OptionalPromise } from '../../dist/index.js';
import type { CreateFrameSourceOptions, FrameSource, CanvasLayer, CustomFabricFunctionCallbacks, Layer, OptionalPromise } from '../types.js';

export type FabricFrameSourceOptions<T> = CreateFrameSourceOptions<T> & { fabric: typeof fabric };
export type FabricFrameSourceCallback<T> = (options: FabricFrameSourceOptions<T>) => OptionalPromise<CustomFabricFunctionCallbacks>;
Expand Down
Loading