Skip to content

Commit f3ad8f1

Browse files
mjh1iamelihjpotter92livepeer-robotlivepeer-docker
authored
Eli/static ffmpeg (#721)
* downloader: handle non-archived binaries * manifest: add ffmpeg * ci: don't try and push docker images on forks * Add ffprobe to manifest * Dockerfile: Do not install ffmpeg as runtime dependency. * Add ffmpeg apt install back in * Update catalyst (#724) * [AUTO-COMMIT] Update `manifest.yaml` (#722) Files changed: M manifest.yaml Co-authored-by: livepeer-docker <[email protected]> * go.mod: Bump `testcontainers` package version * Revert "go.mod: Bump `testcontainers` package version" This reverts commit a7b570d. * leave app versions unchanged * Dockerfile: Use a different ppa for installing ffmpeg --------- Co-authored-by: Eli Mallon <[email protected]> Co-authored-by: hjpotter92 <[email protected]> Co-authored-by: livepeer-robot <[email protected]> Co-authored-by: livepeer-docker <[email protected]>
1 parent 9b9dd9c commit f3ad8f1

File tree

4 files changed

+45
-17
lines changed

4 files changed

+45
-17
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112

113113
upload:
114114
name: Upload artifacts to google bucket
115+
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
115116
permissions:
116117
contents: "read"
117118
id-token: "write"

.github/workflows/catalyst.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ jobs:
7474

7575
- name: Login to DockerHub
7676
uses: docker/login-action@v3
77+
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
7778
with:
7879
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
7980
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
8081

8182
- name: Log in to the Container registry
83+
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
8284
uses: docker/login-action@v3
8385
with:
8486
registry: ghcr.io
@@ -108,7 +110,7 @@ jobs:
108110
uses: docker/build-push-action@v5
109111
with:
110112
platforms: ${{ matrix.targets.platforms }}
111-
push: true
113+
push: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
112114
target: ${{ matrix.docker_images.target }}
113115
build-args: |
114116
GIT_VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.event.pull_request.head.sha || github.sha }}

Dockerfile

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ FROM catalyst-${BUILD_TARGET}-build as catalyst-build
4444
FROM node:18.14.0 as node-build
4545
ARG LIVEPEER_W3_VERSION=v0.2.2
4646
WORKDIR /app
47-
RUN git clone --depth 1 --branch ${LIVEPEER_W3_VERSION} https://github.com/livepeer/go-tools.git
48-
RUN npm install --prefix /app/go-tools/w3
47+
4948
# chown needed to make everything owned by one user for userspace podman execution
50-
RUN chown -R root:root /app/go-tools/w3
49+
RUN git clone --depth 1 --branch ${LIVEPEER_W3_VERSION} https://github.com/livepeer/go-tools.git \
50+
&& npm install --prefix /app/go-tools/w3 \
51+
&& chown -R root:root /app/go-tools/w3
5152

5253
FROM rust:1.73.0 as rust-build
5354
RUN cargo install --version 0.6.2 c2patool
@@ -60,8 +61,10 @@ LABEL maintainer="Amritanshu Varshney <[email protected]>"
6061

6162
ARG BUILD_TARGET
6263

63-
RUN apt update && apt install -yqq wget
64-
RUN wget -O - https://deb.nodesource.com/setup_18.x | bash
64+
RUN apt update && apt install -yqq wget software-properties-common \
65+
&& wget -O - https://deb.nodesource.com/setup_18.x | bash \
66+
&& add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg6
67+
6568
RUN apt update && apt install -yqq \
6669
curl \
6770
ca-certificates \
@@ -74,12 +77,14 @@ RUN apt update && apt install -yqq \
7477
&& rm -rf /var/lib/apt/lists/*
7578

7679
# Most of ./scripts is for livepeer-in-a-box except livepeer-vmagent, which is used in production in Catalyst proper
77-
ADD ./scripts/livepeer-vmagent /usr/local/bin
80+
ADD ./scripts/livepeer-vmagent /usr/local/bin
81+
7882
COPY --from=catalyst-build /opt/bin/ /usr/local/bin/
7983
COPY --from=rust-build /usr/local/cargo/bin/c2patool /bin/
8084
COPY --from=node-build /app/go-tools/w3 /opt/local/lib/livepeer-w3
81-
RUN ln -s /opt/local/lib/livepeer-w3/livepeer-w3.js /usr/local/bin/livepeer-w3 && \
82-
npm install -g ipfs-car
85+
86+
RUN ln -s /opt/local/lib/livepeer-w3/livepeer-w3.js /usr/local/bin/livepeer-w3 \
87+
&& npm install -g ipfs-car
8388

8489
EXPOSE 1935 4242 8080 8889/udp
8590

@@ -100,27 +105,27 @@ RUN apt update && apt install -yqq \
100105
coturn \
101106
&& rm -rf /var/lib/apt/lists/*
102107

103-
RUN curl -L -O https://binaries.cockroachdb.com/cockroach-v23.1.5.linux-$TARGETARCH.tgz \
108+
RUN curl -L -O https://binaries.cockroachdb.com/cockroach-v23.1.5.linux-$TARGETARCH.tgz \
104109
&& tar xzvf cockroach-v23.1.5.linux-$TARGETARCH.tgz \
105110
&& mv cockroach-v23.1.5.linux-$TARGETARCH/cockroach /usr/bin/cockroach \
106111
&& rm -rf cockroach-v23.1.5.linux-$TARGETARCH.tgz cockroach-v23.1.5.linux-$TARGETARCH \
107112
&& cockroach --version
108113

109-
RUN curl -o /usr/bin/minio https://dl.min.io/server/minio/release/linux-$TARGETARCH/minio \
114+
RUN curl -o /usr/bin/minio https://dl.min.io/server/minio/release/linux-$TARGETARCH/minio \
110115
&& curl -o /usr/bin/mc https://dl.min.io/client/mc/release/linux-$TARGETARCH/mc \
111116
&& chmod +x /usr/bin/minio /usr/bin/mc \
112117
&& minio --version \
113118
&& mc --version
114119

115-
ADD ./scripts /usr/local/bin
116-
ADD ./config/full-stack.json /etc/livepeer/full-stack.json
120+
COPY --link ./scripts /usr/local/bin
121+
COPY --link ./config/full-stack.json /etc/livepeer/full-stack.json
117122

118-
ENV CATALYST_DOWNLOADER_PATH=/usr/local/bin \
123+
ENV CATALYST_DOWNLOADER_PATH=/usr/local/bin \
119124
CATALYST_DOWNLOADER_MANIFEST=/etc/livepeer/manifest.yaml \
120125
CATALYST_DOWNLOADER_UPDATE_MANIFEST=true \
121126
COCKROACH_DB_SNAPSHOT=https://github.com/iameli-streams/livepeer-in-a-box-database-snapshots/raw/2eb77195f64f22abf3f0de39e6f6930b82a4c098/livepeer-studio-bootstrap.tar.gz
122127

123-
RUN mkdir /data
128+
RUN mkdir /data
124129

125130
CMD ["/usr/local/bin/catalyst", "--", "/usr/local/bin/MistController", "-c", "/etc/livepeer/full-stack.json"]
126131

cmd/downloader/downloader/downloader.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,24 @@ func DownloadService(flags types.CliFlags, manifest *types.BoxManifest, service
7878
}
7979

8080
glog.Infof("downloaded %s. Getting ready for extraction!", projectInfo.ArchiveFileName)
81-
if projectInfo.Platform == "windows" {
81+
if strings.HasSuffix(projectInfo.ArchiveFileName, ".zip") {
8282
glog.V(7).Info("extracting zip archive!")
8383
err = ExtractZipArchive(archivePath, downloadPath, service)
8484
if err != nil {
8585
return err
8686
}
87-
} else {
87+
} else if strings.HasSuffix(projectInfo.ArchiveFileName, ".tar.gz") {
8888
glog.V(7).Infof("extracting tarball archive!")
8989
err = ExtractTarGzipArchive(archivePath, downloadPath, service)
9090
if err != nil {
9191
return err
9292
}
93+
} else {
94+
glog.V(7).Infof("moving %s to %s!", archivePath, downloadPath)
95+
err = MoveBinaryIntoPlace(archivePath, downloadPath, service)
96+
if err != nil {
97+
return err
98+
}
9399
}
94100
return nil
95101
}
@@ -130,6 +136,20 @@ func ExtractZipArchive(archiveFile, extractPath string, service *types.Service)
130136
return nil
131137
}
132138

139+
// no gzip, no anything, just put it there!
140+
func MoveBinaryIntoPlace(archiveFile, extractPath string, service *types.Service) error {
141+
var outputPath string
142+
if len(service.ArchivePath) > 0 {
143+
outputPath = filepath.Join(extractPath, service.ArchivePath)
144+
}
145+
if len(service.OutputPath) > 0 {
146+
outputPath = filepath.Join(extractPath, service.OutputPath)
147+
}
148+
os.Rename(archiveFile, outputPath)
149+
os.Chmod(outputPath, 0755)
150+
return nil
151+
}
152+
133153
// ExtractTarGzipArchive processes a tarball file and extracts a
134154
// single file from the service definition.
135155
func ExtractTarGzipArchive(archiveFile, extractPath string, service *types.Service) error {

0 commit comments

Comments
 (0)