Skip to content

Commit

Permalink
feat: add docker image builds
Browse files Browse the repository at this point in the history
Completes the docker images for all applications
  • Loading branch information
TroyKomodo committed Dec 28, 2023
1 parent 16ed2a1 commit db75909
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 131 deletions.
15 changes: 9 additions & 6 deletions docker/cve.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
set -e
set -ex

apt-get update

apt-get install -y --no-install-recommends \
libgnutls30 \
libssl3 \
libsystemd0 \
libudev1 \
tar \
libc-bin=2.37-0ubuntu2.2 \
libc6=2.37-0ubuntu2.2 \
tar=1.34+dfsg-1.2ubuntu0.2 \
ca-certificates

apt-get remove --purge -y --allow-remove-essential \
login \
passwd

apt clean
rm -rf /var/lib/apt/lists/*
54 changes: 0 additions & 54 deletions docker/ffmpeg-base.Dockerfile

This file was deleted.

68 changes: 68 additions & 0 deletions docker/ffmpeg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
set -ex

apt-get update
apt-get install -y --no-install-recommends \
tar \
make \
zip \
unzip \
curl \
wget \
git \
ssh \
ca-certificates \
pkg-config \
gnupg2 \
cmake \
clang-format \
ninja-build \
nasm \
yasm \
meson \
libtool \
autoconf \
automake \
build-essential

git clone https://github.com/ScuffleTV/external.git --depth 1 --recurse-submodule --shallow-submodules /tmp/external
/tmp/external/build.sh --prefix /usr/local --build "x264 x265 svt-av1 libvpx opus dav1d ffmpeg"
ldconfig
rm -rf /tmp/external

apt-get remove -y --purge \
make \
zip \
unzip \
curl \
wget \
git \
ssh \
ca-certificates \
pkg-config \
gnupg2 \
cmake \
clang-format \
ninja-build \
nasm \
yasm \
meson \
libtool \
autoconf \
automake \
build-essential \
libpython3.11-stdlib \
libpython3.11-minimal \
libpython3.11 \
python3.11 \
python3.11-minimal \
g++ \
g++-12 \
gcc \
gcc-12 \
"*-dev" \
"*-dev-*"

apt-get autoremove -y
apt-get clean
rm -rf /var/lib/apt/lists/*
rm /etc/ssh -rf
3 changes: 3 additions & 0 deletions docker/platform/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/platform-api,dst=/mount/platform-api \
cp /mount/platform-api /app/platform-api && \
chmod +x /app/platform-api
Expand Down
23 changes: 23 additions & 0 deletions docker/platform/image-processor.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:lunar

LABEL org.opencontainers.image.source=https://github.com/scuffletv/scuffle
LABEL org.opencontainers.image.description="Platform Image Processor Container for ScuffleTV"
LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN --mount=type=bind,src=docker/ffmpeg.sh,dst=/mount/ffmpeg.sh \
/mount/ffmpeg.sh

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/platform-image-processor,dst=/mount/platform-image-processor \
cp /mount/platform-image-processor /app/platform-image-processor && \
chmod +x /app/platform-image-processor

# STOPSIGNAL SIGTERM

# USER 1000

# ENTRYPOINT ["/app/platform-image-processor"]
54 changes: 0 additions & 54 deletions docker/platform/image_processor.Dockerfile

This file was deleted.

17 changes: 4 additions & 13 deletions docker/platform/website.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM node:alpine
FROM nginx:alpine

LABEL org.opencontainers.image.source=https://github.com/scuffletv/scuffle
LABEL org.opencontainers.image.description="Platform Website Container for ScuffleTV"
LABEL org.opencontainers.image.description="Player Demo Website Container for ScuffleTV"
LABEL org.opencontainers.image.licenses=BSD-4-Clause

RUN apk add --upgrade libcrypto3 libssl3 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community

COPY platform/website/build /app/build
COPY platform/website/entry.js /app/index.js

RUN echo "{\"type\": \"module\"}" > /app/package.json && chown -R 1000:1000 /app

WORKDIR /app
COPY platform/website/build /usr/share/nginx/html

STOPSIGNAL SIGTERM

USER 1000

CMD ["node", "."]
ENTRYPOINT ["nginx", "-g", "daemon off;"]
3 changes: 3 additions & 0 deletions docker/video/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/video-api,dst=/mount/video-api \
cp /mount/video-api /app/video-api && \
chmod +x /app/video-api
Expand Down
3 changes: 3 additions & 0 deletions docker/video/edge.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/video-edge,dst=/mount/video-edge \
cp /mount/video-edge /app/video-edge && \
chmod +x /app/video-edge
Expand Down
3 changes: 3 additions & 0 deletions docker/video/ingest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/video-ingest,dst=/mount/video-ingest \
cp /mount/video-ingest /app/video-ingest && \
chmod +x /app/video-ingest
Expand Down
9 changes: 5 additions & 4 deletions docker/video/transcoder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ LABEL org.opencontainers.image.licenses=BSD-4-Clause

WORKDIR /app

RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN --mount=type=bind,src=docker/ffmpeg.sh,dst=/mount/ffmpeg.sh \
/mount/ffmpeg.sh

RUN --mount=type=bind,src=docker/cve.sh,dst=/mount/cve.sh \
/mount/cve.sh

RUN --mount=type=bind,src=target/release/video-transcoder,dst=/mount/video-transcoder \
cp /mount/video-transcoder /app/video-transcoder && \
Expand Down
55 changes: 55 additions & 0 deletions maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,58 @@ fi

cloc $(git ls-files)
```

## docker

> Builds docker images
**OPTIONS**

- version
- flags: --version
- type: string
- desc: Version to use

```bash
set -e
if [[ "$verbose" == "true" ]]; then
set -x
fi

if [ "$version" == "" ]; then
version="latest"
fi

$MASK docker build --file ./docker/platform/api.Dockerfile --tag ghcr.io/scuffletv/platform/api:$version
$MASK docker build --file ./docker/platform/image-processor.Dockerfile --tag ghcr.io/scuffletv/platform/image-processor:$version
$MASK docker build --file ./docker/platform/website.Dockerfile --tag ghcr.io/scuffletv/platform/website:$version

$MASK docker build --file ./docker/video/api.Dockerfile --tag ghcr.io/scuffletv/video/api:$version
$MASK docker build --file ./docker/video/edge.Dockerfile --tag ghcr.io/scuffletv/video/edge:$version
$MASK docker build --file ./docker/video/ingest.Dockerfile --tag ghcr.io/scuffletv/video/ingest:$version
$MASK docker build --file ./docker/video/player-demo.Dockerfile --tag ghcr.io/scuffletv/video/player-demo:$version
$MASK docker build --file ./docker/video/transcoder.Dockerfile --tag ghcr.io/scuffletv/video/transcoder:$version

```

### build

**OPTIONS**

- file
- flags: --file
- type: string
- desc: Dockerfile to use
- tag
- flags: --tag
- type: string
- desc: Tag to use

```bash
set -e
if [[ "$verbose" == "true" ]]; then
set -x
fi

docker build -f $file --tag $tag .
```

0 comments on commit db75909

Please sign in to comment.