test-card/Earthfile
Tomáš Mládek 90b6f36ce7
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: add a/v sync indicator scaffolding + PoC
2024-02-18 21:48:36 +01:00

54 lines
2 KiB
Text

VERSION 0.7
FROM node:lts
avsync-video-components:
# https://pptr.dev/troubleshooting
RUN apt-get update && apt-get -y install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 && rm -rf /var/lib/apt/lists/*
RUN npm install -g pnpm
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser && mkdir /home/pptruser && chown -R pptruser:pptruser /home/pptruser
USER pptruser
COPY av-sync/package.json av-sync/pnpm-lock.yaml /av-sync
WORKDIR /av-sync
CACHE /home/pptruser/.local/share/pnpm
RUN pnpm install
COPY av-sync /av-sync
ARG FPS=60
ARG CYCLES=4
ARG SIZE=1200
RUN pnpm serve-render --fps $FPS --cycles $CYCLES --size $SIZE --output frames
RUN pnpm render-audio -i beep.wav -o track.wav --repeats $CYCLES
SAVE ARTIFACT frames
SAVE ARTIFACT track.wav
avsync-video:
FROM debian:bookworm
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
COPY +avsync-video-components/track.wav /track.wav
COPY +avsync-video-components/frames /frames
RUN find frames -type f | sort | xargs -I {} sh -c 'echo "file {}" >> /frames.txt'
ARG FPS=60
RUN ffmpeg -r $FPS -f concat -i /frames.txt -i track.wav -c:v libvpx-vp9 -pix_fmt yuva420p -shortest avsync.webm
SAVE ARTIFACT avsync.webm
site:
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml /site
WORKDIR /site
CACHE $HOME/.local/share/pnpm
RUN pnpm install --frozen-lockfile
COPY . /site
RUN pnpm build
SAVE ARTIFACT build AS LOCAL build
deploy:
FROM alpine
RUN apk add openssh-client rsync
RUN --secret SSH_CONFIG --secret SSH_UPLOAD_KEY --secret SSH_KNOWN_HOSTS \
mkdir -p $HOME/.ssh && \
echo "$SSH_CONFIG" > $HOME/.ssh/config && \
echo "$SSH_UPLOAD_KEY" > $HOME/.ssh/id_rsa && \
echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts && \
chmod 600 $HOME/.ssh/*
COPY +site/build /build
RUN --secret SSH_TARGET --push rsync -cvrz --delete /build/ $SSH_TARGET