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

50 lines
1.8 KiB
Text

VERSION 0.7
FROM node:lts
avsync-video-frames:
# 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 /av-sync
WORKDIR /av-sync
CACHE /home/pptruser/.local/share/pnpm
RUN pnpm install
ARG FPS=60
ARG CYCLES=4
ARG SIZE=1200
RUN pnpm serve-render --fps $FPS --cycles $CYCLES --size $SIZE --output frames
SAVE ARTIFACT frames
avsync-video:
FROM debian:bookworm
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
COPY +avsync-video-frames/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 -c:v libvpx-vp9 -lossless 1 -pix_fmt yuva420p -an avsync.webm
SAVE ARTIFACT avsync.mp4
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