Skip to content

Commit

Permalink
Merge pull request #39 from livepeer/eli/docker
Browse files Browse the repository at this point in the history
add new simple Catalyst Dockerfile
  • Loading branch information
iameli authored Jul 11, 2022
2 parents 51baf48 + a544b00 commit 2350d42
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 172 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.*
*~
Dockerfile.catalyst
Dockerfile
bin/
lib/
build/
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1-stretch as gobuild

ARG GIT_VERSION=unknown

WORKDIR /build

ADD go.mod go.mod
ADD go.sum go.sum
RUN go mod download
ADD . .
RUN make
RUN ls bin

FROM ubuntu:20.04

LABEL maintainer="Amritanshu Varshney <[email protected]>"

# Needed for working TLS
RUN apt-get update \
&& apt-get install -y ca-certificates musl \
&& rm -rf /var/lib/apt/lists/*

COPY --from=gobuild /build/bin/ /usr/bin/

EXPOSE 1935 4242 8080 8889/udp

ENTRYPOINT ["/usr/bin/catalyst"]
112 changes: 0 additions & 112 deletions Dockerfile.catalyst

This file was deleted.

20 changes: 8 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ PROC_COUNT+="$(shell nproc)"
CMAKE_INSTALL_PREFIX=$(shell realpath .)
# The -DCMAKE_OSX_ARCHITECTURES flag should be ignored on non-OSX platforms
CMAKE_OSX_ARCHITECTURES=$(shell uname -m)
GO_LDFLAG_VERSION := -X 'main.Version=$(shell git describe --all --dirty)'
GIT_VERSION?=$(shell git describe --all --dirty)
GO_LDFLAG_VERSION := -X 'main.Version=$$GIT_VERSION'
MIST_COMMIT ?= "catalyst"
STRIP_BINARIES ?= "true"

Expand All @@ -12,7 +13,7 @@ $(shell mkdir -p $(HOME)/.config/livepeer)
buildpath=$(realpath ./build)

.PHONY: all
all: download mistserver livepeer-log ffmpeg livepeer-task-runner
all: download livepeer-log livepeer-catalyst-node

.PHONY: ffmpeg
ffmpeg:
Expand All @@ -21,7 +22,7 @@ ffmpeg:

.PHONY: build
build:
go build -ldflags="$(GO_LDFLAG_VERSION)" -o build/downloader main.go
go build -ldflags="$(GO_LDFLAG_VERSION)" -o build/downloader cmd/downloader/main/downloader.go

build/compiled/lib/libmbedtls.a:
export PKG_CONFIG_PATH=$(buildpath)/compiled/lib/pkgconfig \
Expand Down Expand Up @@ -106,17 +107,9 @@ livepeer-mist-api-connector:
&& cd - \
&& cp ../stream-tester/build/mist-api-connector ./bin/livepeer-mist-api-connector

.PHONY: livepeer-catalyst-node
livepeer-catalyst-node:
set -x \
&& cd ../catalyst-node \
&& make \
&& cd - \
&& cp ../catalyst-node/build/catalyst-node ./bin/livepeer-catalyst-node

.PHONY: download
download:
go run main.go -v=5 $(ARGS)
go run cmd/downloader/main/downloader.go -v=5 $(ARGS)

.PHONY: dev
dev:
Expand Down Expand Up @@ -171,3 +164,6 @@ full-reset: docker-compose-rm clean all
.PHONY: livepeer-catalyst-node
livepeer-catalyst-node:
go build -o ./bin/livepeer-catalyst-node -ldflags="$(GO_LDFLAG_VERSION)" cmd/catalyst-node/catalyst-node.go

docker:
docker build -t catalyst --build-arg=GIT_VERSION=$(GIT_VERSION) .
87 changes: 40 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

## Getting Started

You'll presently need the following repos cloned into the same
directory as catalyst:

- [go-livepeer](https://github.com/livepeer/go-livepeer) (any branch, only there for `install_ffmpeg.sh`)
- [mistserver](https://github.com/DDVTECH/mistserver) (`catalyst` branch)
- [task-runner](https://github.com/livepeer/task-runner) (`main` branch)

go1.17 is recommended because building with < 1.17 (specifically 1.16) can result in issue on arm64 architectures.

From there:
Expand Down Expand Up @@ -60,44 +53,44 @@ release: latest

# Services inside the box
box:
# array of each service element
- name: name

# custom release value (if working on specific tag)
# Can be the branch name for `bucket` strategy (see below)
release: v99.99.99

# override artifact name generation pattern. default pattern is:
# <name>-<platform>-<arch>.tar.gz for linux/macos
# <name>-<platform>-<arch>.zip for windows
# overrides to using `<binary>-<platform>-<arch>.<ext>`
binary: livepeer-www

# path inside the archive zip/tar which is needed for the service
archivePath: victoria-metrics-prod

# output name of the binary located at `archivePath`
outputPath: livepeer-victoria-metrics

# Strategy to use for downloading artifacts: github or bucket
# `bucket` - Uses `build.livepeer.live` bucket; works for branches of some projects
# `github` - Uses github releases and tags (default value)
strategy:
download: github
# `project` => github project/repo or bucket key for artifacts
project: livepeer/project-name

# key-value for mapping platform to custom artifact on github release page
# this bypasses default name generation pattern entirely
srcFilenames:
linux-amd64: victoria-metrics-amd64-v1.74.0.tar.gz
linux-arm64: victoria-metrics-arm64-v1.74.0.tar.gz
darwin-amd64: victoria-metrics-darwin-amd64-v1.74.0.tar.gz
darwin-arm64: victoria-metrics-darwin-arm64-v1.74.0.tar.gz

# Skip gpg signature verification step
skipGpg: true

# Skip sha digest check for artifact
skipChecksum: true
# array of each service element
- name: name

# custom release value (if working on specific tag)
# Can be the branch name for `bucket` strategy (see below)
release: v99.99.99

# override artifact name generation pattern. default pattern is:
# <name>-<platform>-<arch>.tar.gz for linux/macos
# <name>-<platform>-<arch>.zip for windows
# overrides to using `<binary>-<platform>-<arch>.<ext>`
binary: livepeer-www

# path inside the archive zip/tar which is needed for the service
archivePath: victoria-metrics-prod

# output name of the binary located at `archivePath`
outputPath: livepeer-victoria-metrics

# Strategy to use for downloading artifacts: github or bucket
# `bucket` - Uses `build.livepeer.live` bucket; works for branches of some projects
# `github` - Uses github releases and tags (default value)
strategy:
download: github
# `project` => github project/repo or bucket key for artifacts
project: livepeer/project-name

# key-value for mapping platform to custom artifact on github release page
# this bypasses default name generation pattern entirely
srcFilenames:
linux-amd64: victoria-metrics-amd64-v1.74.0.tar.gz
linux-arm64: victoria-metrics-arm64-v1.74.0.tar.gz
darwin-amd64: victoria-metrics-darwin-amd64-v1.74.0.tar.gz
darwin-arm64: victoria-metrics-darwin-arm64-v1.74.0.tar.gz

# Skip gpg signature verification step
skipGpg: true

# Skip sha digest check for artifact
skipChecksum: true
```
5 changes: 5 additions & 0 deletions cmd/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ func Run(buildFlags types.BuildFlags) {
glog.Fatal(err)
return
}
err = os.MkdirAll(cliFlags.DownloadPath, os.ModePerm)
if err != nil {
glog.Fatal(err)
return
}
for _, element := range manifest.Box {
if element.Skip {
continue
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ box:
strategy:
download: bucket
project: mistserver
release: eli/json-manifest
release: catalyst
skipGpg: true

- name: www
Expand Down

0 comments on commit 2350d42

Please sign in to comment.