test-card/Earthfile

57 lines
2.2 KiB
Text
Raw Normal View History

2024-02-02 21:46:22 +01:00
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
2024-02-18 22:22:38 +01:00
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
2024-02-18 22:22:38 +01:00
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
2024-02-02 21:46:22 +01:00
site:
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml /site
WORKDIR /site
2024-02-18 22:22:38 +01:00
CACHE --id=pnpm $HOME/.local/share/pnpm
RUN pnpm install --frozen-lockfile --prod
2024-02-02 21:46:22 +01:00
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
2024-02-03 18:27:15 +01:00
RUN --secret SSH_TARGET --push rsync -cvrz --delete /build/ $SSH_TARGET
2024-02-02 21:46:22 +01:00