Skip to content

Commit 3644fb0

Browse files
committed
Docker: Update image FFmpeg to compliant policy non-root user
[skip ci] Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent d01680c commit 3644fb0

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.ffmpeg/Dockerfile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:noble AS builder
2-
ARG VERSION_FFMPEG="7.1"
3-
ARG VERSION_RCLONE="v1.68.2"
4-
ARG VERSION_GO="latest"
2+
ARG FFMPEG_VERSION="7.1"
3+
ARG RCLONE_VER="v1.68.2"
4+
ARG GO_VERSION="latest"
55
ARG GO_CRYPTO_VERSION="v0.31.0"
66
ARG GO_NET_VERSION="v0.33.0"
77

@@ -19,19 +19,19 @@ RUN apt-get update -qqy \
1919
&& apt-get -qyy clean \
2020
&& mkdir -p /usr/local/src
2121

22-
RUN if [ "${VERSION_GO}" = "latest" ]; then \
23-
VERSION_GO=$(curl -sk https://go.dev/dl/?mode=json | jq -r '.[0].version'); \
22+
RUN if [ "${GO_VERSION}" = "latest" ]; then \
23+
GO_VERSION=$(curl -sk https://go.dev/dl/?mode=json | jq -r '.[0].version'); \
2424
fi \
25-
&& curl -skLO https://go.dev/dl/$VERSION_GO.linux-$(dpkg --print-architecture).tar.gz \
26-
&& tar -xf $VERSION_GO.linux-$(dpkg --print-architecture).tar.gz -C /usr/local \
27-
&& rm -rf $VERSION_GO.linux-$(dpkg --print-architecture).tar.gz* \
25+
&& curl -skLO https://go.dev/dl/${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz \
26+
&& tar -xf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz -C /usr/local \
27+
&& rm -rf ${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz* \
2828
&& ln -sf /usr/local/go/bin/go /usr/bin/go \
2929
&& go version
3030

3131
RUN cd /usr/local/src \
3232
&& git clone https://github.com/rclone/rclone.git \
3333
&& cd rclone \
34-
&& git checkout $VERSION_RCLONE \
34+
&& git checkout ${RCLONE_VER} \
3535
# Patch deps version in go.mod to fix CVEs
3636
&& sed -i "s|golang.org/x/crypto v.*|golang.org/x/crypto ${GO_CRYPTO_VERSION}|g" go.mod \
3737
&& sed -i "s|golang.org/x/net v.*|golang.org/x/net ${GO_NET_VERSION}|g" go.mod \
@@ -57,8 +57,9 @@ RUN cd /usr/local/src \
5757
RUN cd /usr/local/src \
5858
&& git clone https://github.com/FFmpeg/FFmpeg.git \
5959
&& cd FFmpeg \
60-
&& git checkout release/$VERSION_FFMPEG \
61-
&& PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure \
60+
&& git checkout release/${FFMPEG_VERSION} \
61+
&& rm -rf .git \
62+
&& PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" FFMPEG_VERSION=${FFMPEG_VERSION} ./configure \
6263
--prefix="/usr/local" \
6364
--extra-cflags="-I/usr/local/include" \
6465
--extra-ldflags="-L/usr/local/lib" \
@@ -87,3 +88,5 @@ RUN apt-get -qqy update \
8788
RUN ldd /usr/local/bin/ffmpeg \
8889
&& ffmpeg -version \
8990
&& rclone --version
91+
92+
USER 101

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ video: base
251251
cd ./Video && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg FFMPEG_BASED_NAME=$(FFMPEG_BASED_NAME) --build-arg FFMPEG_BASED_TAG=$(FFMPEG_BASED_TAG) $(FROM_IMAGE_ARGS) -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .
252252

253253
ffmpeg:
254-
cd ./.ffmpeg && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg VERSION_FFMPEG=$(FFMPEG_VERSION) $(FROM_IMAGE_ARGS) -t $(NAME)/ffmpeg:$(FFMPEG_VERSION)-$(BUILD_DATE) .
254+
cd ./.ffmpeg && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg FFMPEG_VERSION=$(FFMPEG_VERSION) $(FROM_IMAGE_ARGS) -t $(NAME)/ffmpeg:$(FFMPEG_VERSION)-$(BUILD_DATE) .
255255

256256
fetch_grid_scaler_resources:
257257
mkdir -p ./.keda/scalers \

0 commit comments

Comments
 (0)