R
Railway12mo ago
hammyg

FFMPEG issues despite recommendations

I'm having a few issues getting FFMPEG started. Firstly, I found that the package could not be found. There is a fix here that fixes that error by changing the nixpacks.toml: [phases.setup] aptPkgs = ["...", "ffmpeg"] however, I'm faced with a new error: ffmpeg: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.36' not found (required by /nix/store/xpxln7rqi3pq4m0xpnawhxb2gs0mn1s0-gcc-12.3.0-lib/lib/libstdc++.so.6) I'm seeing some suggestions to maybe lower my build version like this: [build] nixpacksVersion = "1.15.0" ` But still having no results. Built with FastAPI, python, and FFMPEG. Service ID: 8b2dbccb-8e08-4422-a6da-0b275b5f66fc
12 Replies
Percy
Percy12mo ago
Project ID: 8b2dbccb-8e08-4422-a6da-0b275b5f66fc
maddsua
maddsua12mo ago
ffmpeg can be added to the app image using docker's multi-stage builds. It requires using Dockerfile but should actually work
hammyg
hammygOP12mo ago
Anywhere you can point me to setting something like that up? Don't really have experience with Docker.
maddsua
maddsua12mo ago
Shamelessly stole kindly borrowed this snippet from stack overflow:
FROM golang:1.7.3
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]
FROM golang:1.7.3
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]
basically they take multiple images and combine then into a single one I should mention that you'd need to grab images for the same OS and preferably distro (like everything for alpine or everything for debian/ubuntu) I can also share a dockerfile I've used to deploy a deno app, but it's just a single stage. You can use it as a starting point for installing fast api and python:
FROM denoland/deno:alpine

WORKDIR /app/

COPY . /app/.
COPY ./.build/run.js /app/run.js

RUN deno cache -r run.js

EXPOSE 8080

CMD ["deno", "tast", "start"]
FROM denoland/deno:alpine

WORKDIR /app/

COPY . /app/.
COPY ./.build/run.js /app/run.js

RUN deno cache -r run.js

EXPOSE 8080

CMD ["deno", "tast", "start"]
Here it takes deno from the base image, grabs my run.js and caches http dependencies (equivalent of npm install or pip install*). Then exposes app port and runs start command the star after pip install is there because I have no idea how python install it's packages and I just assume it's that command Also dropping a dockerfile example for python itself
FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./your-daemon-or-script.py" ]
FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./your-daemon-or-script.py" ]
https://hub.docker.com/_/python Actually you can also just assemble it all from a base image
hammyg
hammygOP12mo ago
But there's essentially no way to do this through Railway exclusively with build commands, etc?
maddsua
maddsua12mo ago
probably not. maybe more experienced guys can help with that take python:3-bookworm as base image and install ffmpeg into it with apt install ffmpeg If you want me to I can try doing it
Brody
Brody12mo ago
@hammyg - first, the nixpacks version thing goes in a railway.toml file, not a nixpacks.toml file. second, try adding this under your phases.setup nixLibs = ['...', 'zlib']
hammyg
hammygOP12mo ago
Updated nixpacks.toml: [phases.setup] aptPkgs = ["...", "ffmpeg"] nixLibs = ['...', 'zlib'] Created railway.toml to test as well: [build] nixpacksVersion = "1.15.0" Still unfortunately left with the error: ffmpeg: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/xpxln7rqi3pq4m0xpnawhxb2gs0mn1s0-gcc-12.3.0-lib/lib/libstdc++.so.6)
Brody
Brody12mo ago
does the build table at the top of the build logs say it's running on nixpacks 1.15.0 now?
hammyg
hammygOP12mo ago
Thanks for responding, by the way. It does I believe:
No description
Brody
Brody12mo ago
and you still get a GLIBC_2.36 error? can you try a build where you arent specifying the nixpacks version?
hammyg
hammygOP12mo ago
Oops, never mind. Looks like the version change did fix this issue, I'm sorry. Thank you for pointing out how to properly put a fixed version for railway. It might be a worthwhile discussion to eventually have this work on the latest version, but the short fix is the version downgrade. Thanks for the help @Brody and @maddsua .
Want results from more Discord servers?
Add your server