VERSION 0.7 FROM node:lts 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 COPY +assets-generated/ /site/assets/generated 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 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 av-sync av-sync ARG FPS=60 ARG CYCLES=16 ARG SIZE=1200 RUN pnpm av:render:video --fps $FPS --cycles 1 --size $SIZE --output /var/tmp/frames SAVE ARTIFACT /var/tmp/frames RUN pnpm av:render:audio -i beep.wav -o /var/tmp/track.wav --repeats $CYCLES SAVE ARTIFACT /var/tmp/track.wav aux-media: FROM debian:bookworm RUN apt-get update && apt-get install -y ffmpeg sox && rm -rf /var/lib/apt/lists/* avsync-video: FROM +aux-media RUN apt-get update && apt-get install -y ffmpeg sox && 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 audio-channel-tracks: FROM +aux-media RUN mkdir -p /input /output COPY assets/audio/channels /raw WORKDIR /raw RUN for file in *.wav; do sox $file /input/$file silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse; done WORKDIR /input RUN mkdir -p /output/wav/stereo /output/wav/5.1 /output/wav/7.1 RUN ffmpeg -i Left.wav -af "pan=stereo|FL=c0" /output/wav/stereo/Left.wav -hide_banner -loglevel error && \ ffmpeg -i Right.wav -af "pan=stereo|FR=c0" /output/wav/stereo/Right.wav -hide_banner -loglevel error && \ ffmpeg -i Center.wav -af "pan=stereo|FL=c0|FR=c0" /output/wav/stereo/Center.wav -hide_banner -loglevel error && \ # 5.1 ffmpeg -i Front_Left.wav -af "pan=5.1|FL=c0" /output/wav/5.1/Front_Left.wav -hide_banner -loglevel error && \ ffmpeg -i Front_Right.wav -af "pan=5.1|FR=c0" /output/wav/5.1/Front_Right.wav -hide_banner -loglevel error && \ ffmpeg -i Front_Center.wav -af "pan=5.1|FC=c0" /output/wav/5.1/Front_Center.wav -hide_banner -loglevel error && \ ffmpeg -i Noise.wav -af "pan=5.1|LFE=c0" /output/wav/5.1/LFE_Noise.wav -hide_banner -loglevel error && \ ffmpeg -i Rear_Left.wav -af "pan=5.1|BL=c0" /output/wav/5.1/Rear_Left.wav -hide_banner -loglevel error && \ ffmpeg -i Rear_Right.wav -af "pan=5.1|BR=c0" /output/wav/5.1/Rear_Right.wav -hide_banner -loglevel error && \ # 7.1 ffmpeg -i Front_Left.wav -af "pan=7.1|FL=c0" /output/wav/7.1/Front_Left.wav -hide_banner -loglevel error && \ ffmpeg -i Front_Right.wav -af "pan=7.1|FR=c0" /output/wav/7.1/Front_Right.wav -hide_banner -loglevel error && \ ffmpeg -i Front_Center.wav -af "pan=7.1|FC=c0" /output/wav/7.1/Front_Center.wav -hide_banner -loglevel error && \ ffmpeg -i Noise.wav -af "pan=7.1|LFE=c0" /output/wav/7.1/LFE_Noise.wav -hide_banner -loglevel error && \ ffmpeg -i Side_Left.wav -af "pan=7.1|SL=c0" /output/wav/7.1/Side_Left.wav -hide_banner -loglevel error && \ ffmpeg -i Side_Right.wav -af "pan=7.1|SR=c0" /output/wav/7.1/Side_Right.wav -hide_banner -loglevel error && \ ffmpeg -i Rear_Left.wav -af "pan=7.1|BL=c0" /output/wav/7.1/Rear_Left.wav -hide_banner -loglevel error && \ ffmpeg -i Rear_Right.wav -af "pan=7.1|BR=c0" /output/wav/7.1/Rear_Right.wav -hide_banner -loglevel error SAVE ARTIFACT /output/wav/ audio-channel-tracks-ogg: FROM +audio-channel-tracks RUN mkdir -p /output/ogg/stereo /output/ogg/5.1 /output/ogg/7.1 RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/stereo/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \ for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/5.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \ for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/7.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done SAVE ARTIFACT /output/ogg audio-channel-tracks-mp3: FROM +audio-channel-tracks RUN mkdir -p /output/mp3/stereo /output/mp3/5.1 /output/mp3/7.1 RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/stereo/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \ for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/5.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \ for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/7.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done SAVE ARTIFACT /output/mp3 assets-generated: COPY +avsync-video/avsync.webm /assets/avsync.webm COPY +audio-channel-tracks-mp3/mp3 /assets/audio/ SAVE ARTIFACT /assets/* AS LOCAL assets/generated/