Build on Docker Fails
Closed this issue · 3 comments
sjakati98 commented
Trying to build on Docker and running into the following issue:
#18 4.671 # github.com/zergon321/reisen
#18 4.671 /go/pkg/mod/github.com/zergon321/reisen@v0.1.8/audioframe.go:17:27: undefined: Stream
#18 4.671 /go/pkg/mod/github.com/zergon321/reisen@v0.1.8/frame.go:17:15: undefined: Stream
#18 4.671 /go/pkg/mod/github.com/zergon321/reisen@v0.1.8/unknown.go:9:2: undefined: baseStream
#18 4.671 /go/pkg/mod/github.com/zergon321/reisen@v0.1.8/videoframe.go:24:27: undefined: Stream
What I've tried:
- Pegging Golang version to
1.17
- Adding necessary dependencies
Here is what the relevant part of my Dockerfile looks like:
# Use the official Golang image as the base image
FROM golang:1.17 AS builder
# Set the working directory inside the container
WORKDIR /app
# Install necessary packages
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:savoury1/ffmpeg4
RUN apt install -y libswscale-dev libavcodec-dev libavformat-dev libswresample-dev libavutil-dev
# Copy the Go module files
COPY go.mod go.sum ./
# Download and cache the Go module dependencies
RUN go mod download
# Copy the source code into the container
COPY . .
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o vidstreamsplit .
Let me know if you've run into this issue before. Happy to try and make a change if you could point me in the write direction.
zergon321 commented
Please check v0.1.9-test with this script:
# Use the official Golang image as the base image
FROM golang:1.17 AS builder
# Set the working directory inside the container
WORKDIR /app
# Install necessary packages
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:savoury1/ffmpeg4
RUN apt install -y libswscale-dev libavcodec-dev libavformat-dev libswresample-dev libavutil-dev
# Copy the Go module files
COPY go.mod go.sum ./
# Download and cache the Go module dependencies
RUN go mod download
# Copy the source code into the container
COPY . .
# Build the Go application
RUN go build -o vidstreamsplit .
sjakati98 commented
Awesome, was able to get it running that way, thanks! Curious what the fix was?
zergon321 commented
For some reason it required the files that depend on the definitions from stream.go
to have pkg-config
directives as well. You can see what exactly was done in the last commit.