test-card/Earthfile
Tomáš Mládek 9b6b5547ba
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
refactor: unify package.jsons
2024-02-18 22:24:09 +01:00

56 lines
2.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 package.json pnpm-lock.yaml /site
WORKDIR /site
CACHE --id=pnpm /home/pptruser/.local/share/pnpm
RUN pnpm install --frozen-lockfile
COPY . /site
ARG FPS=60
ARG CYCLES=16
ARG SIZE=1200
RUN pnpm av:render:video --fps $FPS --cycles 1 --size $SIZE --output /var/tmp/frames
RUN pnpm av:render:audio -i beep.wav -o /var/tmp/track.wav --repeats $CYCLES
SAVE ARTIFACT /var/tmp/frames
SAVE ARTIFACT /var/tmp/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 CYCLES=16
RUN for i in $(seq 1 $CYCLES); do cat /frames.txt >> /final-frames.txt; done
ARG FPS=60
RUN ffmpeg -r $FPS -f concat -i /final-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 --id=pnpm $HOME/.local/share/pnpm
RUN pnpm install --frozen-lockfile --prod
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