Skip to content

Commit

Permalink
dockerfile: Fix glibc dependency issue when building images (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpotter92 authored Jan 23, 2023
1 parent d3279c5 commit 1391780
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
build:
name: Build and publish docker images
name: Build and publish ${{ matrix.build.name }} docker images
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
platforms: linux/amd64
push: true
build-args: |
version=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
version=${{ (github.ref_type == 'tag' && github.ref_name) || (github.event.pull_request.head.sha || github.sha) }}
tags: ${{ steps.meta.outputs.tags }}
file: 'docker/${{ matrix.build.file }}'
labels: ${{ steps.meta.outputs.labels }}
Expand Down
13 changes: 7 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY . .
ARG version

RUN go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" -tags h264 cmd/streamtester/streamtester.go

RUN parallel -q go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" cmd/{}/{}.go ::: testdriver mist-api-connector loadtester stream-monitor recordtester

FROM alpine:3.15.4
Expand All @@ -28,11 +29,11 @@ WORKDIR /root
COPY --from=builder /root/*.mp4 ./
COPY --from=builder /root/official_test_source_2s_keys_24pfs_30s_hls official_test_source_2s_keys_24pfs_30s_hls

COPY --from=builder /root/streamtester /usr/local/bin/streamtester
COPY --from=builder /root/testdriver /usr/local/bin/testdriver
COPY --from=builder /root/mist-api-connector /usr/local/bin/mist-api-connector
COPY --from=builder /root/loadtester /usr/local/bin/loadtester
COPY --from=builder /root/stream-monitor /usr/local/bin/stream-monitor
COPY --from=builder /root/recordtester /usr/local/bin/recordtester
COPY --from=builder /root/streamtester \
/root/testdriver \
/root/mist-api-connector \
/root/loadtester \
/root/stream-monitor \
/root/recordtester /usr/local/bin/

RUN for b in testdriver mist-api-connector loadtester stream-monitor recordtester; do ln -s /usr/local/bin/$b ./$b; done
6 changes: 3 additions & 3 deletions docker/Dockerfile.orch-tester
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ RUN go mod download

COPY . .

ARG version

RUN go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" \
-tags mainnet \
cmd/orch-tester/orch_tester.go cmd/orch-tester/broadcaster_metrics.go

FROM debian:stretch-slim
FROM debian:bullseye-slim

RUN apt update && \
apt install -y ca-certificates && \
Expand All @@ -31,6 +33,4 @@ WORKDIR /root
COPY --from=builder /root/official_test_source_2s_keys_24pfs_30s_hls official_test_source_2s_keys_24pfs_30s_hls
COPY --from=builder /root/orch_tester /usr/local/bin/orch_tester

RUN ln -s /usr/local/bin/orch_tester ./

ENTRYPOINT ["/usr/local/bin/orch_tester"]
10 changes: 5 additions & 5 deletions docker/Dockerfile.record-tester
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ ENV GOARCH="${TARGETARCH}"
WORKDIR /root

ENV GOFLAGS "-mod=readonly"
ARG version

COPY go.mod go.sum ./

RUN go mod download

ARG version

COPY . .

RUN go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" cmd/streamtester/streamtester.go
RUN go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" cmd/recordtester/recordtester.go
RUN CGO_ENABLED=0 go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" cmd/streamtester/streamtester.go \
&& CGO_ENABLED=0 go build -ldflags="-X 'github.com/livepeer/stream-tester/model.Version=$version' -X 'github.com/livepeer/stream-tester/model.IProduction=true'" cmd/recordtester/recordtester.go

FROM --platform=$TARGETPLATFORM debian:stretch-slim

Expand All @@ -25,7 +26,6 @@ RUN apt update && \
apt install -yqq ca-certificates curl && \
apt clean

COPY --from=builder /root/streamtester /usr/local/bin/streamtester
COPY --from=builder /root/recordtester /usr/local/bin/recordtester
COPY --from=builder /root/streamtester /root/recordtester /usr/local/bin/

RUN for b in recordtester streamtester; do ln -s /usr/local/bin/$b ./$b; done

0 comments on commit 1391780

Please sign in to comment.