Skip to content

Commit

Permalink
docker: download files first to hopefully not break cache
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 19, 2024
1 parent 5fbedf9 commit 0af2199
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions Dockerfile.ffmpeg-static-alpine
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
# syntax=docker/dockerfile:1.3

# To build release:
# docker buildx build -f Dockerfile.ffmpeg-static-alpine -t ghcr.io/hybridgroup/ffmpeg:5.1.6-alpine --platform=linux/arm64,linux/amd64 --load .
# docker buildx build -f Dockerfile.ffmpeg-static-alpine -t ghcr.io/hybridgroup/ffmpeg:5.16-alpine --platform=linux/arm64,linux/amd64 --load .

# Stage 1: Build OpenCV
FROM --platform=linux/amd64 alpine:3.20 AS builder-amd64

WORKDIR /

ARG FFMPEG_VERSION=5.1.6
ARG XZ_VERSION=5.6.3

# download xz
RUN wget -O xz-${XZ_VERSION}.tar.bz2 "https://github.com/tukaani-project/xz/releases/download/v${XZ_VERSION}/xz-${XZ_VERSION}.tar.bz2" && \
tar -xf xz-${XZ_VERSION}.tar.bz2

# download bzip2
RUN wget -O bzip2-master.tar.bz2 "https://gitlab.com/bzip2/bzip2/-/archive/master/bzip2-master.tar.bz2" && \
tar -xf bzip2-master.tar.bz2

# download ffmpeg source
RUN wget -O ffmpeg-5.0.tar.bz2 "https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" && \
tar -xf ffmpeg-5.0.tar.bz2

# Install dependencies
RUN apk update && apk add --no-cache \
build-base \
Expand All @@ -24,31 +41,17 @@ RUN apk update && apk add --no-cache \
bzip2 xz zlib-dev x264-dev libvpx-dev \
opus-dev dav1d-dev python3

ARG FFMPEG_VERSION=5.1.6
ARG XZ_VERSION=5.6.3

# Build and install xz
RUN wget -O xz-${XZ_VERSION}.tar.bz2 "https://github.com/tukaani-project/xz/releases/download/v${XZ_VERSION}/xz-${XZ_VERSION}.tar.bz2" && \
tar -xf xz-${XZ_VERSION}.tar.bz2

RUN cd xz-${XZ_VERSION} && \
./configure --disable-shared && \
make && make install

# Build and install bzip2
RUN wget -O bzip2-master.tar.bz2 "https://gitlab.com/bzip2/bzip2/-/archive/master/bzip2-master.tar.bz2" && \
tar -xf bzip2-master.tar.bz2

RUN cd bzip2-master && \
mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE="Release" -DENABLE_STATIC_LIB=ON -DENABLE_LIB_ONLY=ON && \
cmake --build . --target install

# Build and install ffmpeg

RUN wget -O ffmpeg-5.0.tar.bz2 "https://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" && \
tar -xf ffmpeg-5.0.tar.bz2

# Build and install libvpx
RUN cd ffmpeg-${FFMPEG_VERSION} && \
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
Expand Down Expand Up @@ -83,9 +86,6 @@ RUN apk update && apk add --no-cache \
bzip2 xz zlib-dev x264-dev libvpx-dev \
opus-dev dav1d-dev python3

ARG FFMPEG_VERSION=5.1.6
ARG XZ_VERSION=5.6.3

# Build and install xz
RUN wget -O xz-${XZ_VERSION}.tar.bz2 "https://github.com/tukaani-project/xz/releases/download/v${XZ_VERSION}/xz-${XZ_VERSION}.tar.bz2" && \
tar -xf xz-${XZ_VERSION}.tar.bz2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.gstreamer-static-alpine
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR /gstreamer

ARG GST_BUILD_VERSION=1.24
RUN wget https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/${GST_BUILD_VERSION}/gstreamer-${GST_BUILD_VERSION}.tar.gz && \
tar -xvzf gstreamer-${GST_BUILD_VERSION}.tar.gz
tar -xzf gstreamer-${GST_BUILD_VERSION}.tar.gz

WORKDIR /gstreamer/gstreamer-${GST_BUILD_VERSION}

Expand Down Expand Up @@ -59,7 +59,7 @@ WORKDIR /gstreamer

ARG GST_BUILD_VERSION=1.24
RUN wget https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/${GST_BUILD_VERSION}/gstreamer-${GST_BUILD_VERSION}.tar.gz && \
tar -xvzf gstreamer-${GST_BUILD_VERSION}.tar.gz
tar -xzf gstreamer-${GST_BUILD_VERSION}.tar.gz

WORKDIR /gstreamer/gstreamer-${GST_BUILD_VERSION}

Expand Down

0 comments on commit 0af2199

Please sign in to comment.