-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prisma generate
panics when building docker image on alpine base
#466
Comments
Build output including stack trace:
|
I've also played around with alpine containerfiles. ContainerfileARG RUST_VERSION=1.80.1
ARG APP_NAME=my_app
FROM rust:${RUST_VERSION}-alpine AS build
ARG APP_NAME
WORKDIR /app
RUN apk update && \
apk add openssl musl-dev openssl-dev pkgconf && \
cargo install cargo-chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
RUN cargo prisma generate && cargo build --locked --release
FROM alpine:latest AS final
RUN apk update && apk upgrade openssl
COPY --from=build "/app/target/release/my_app" /usr/local/bin
EXPOSE 3000
ENTRYPOINT ["/usr/local/bin/my_app"] Cargo.toml[package]
name = "my_app"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.86"
askama = { version = "0.12.1", features = ["with-axum"] }
askama_axum = "0.4.0"
axum = "0.7.5"
axum-extra = { version = "0.9.3", features = ["cookie-private"] }
dotenvy = "0.15.7"
openidconnect = "3.5.0"
reqwest = { version = "0.12.5", features = ["json"] }
serde = { version = "1.0.206", features = ["derive"] }
serde_json = "1.0.124"
tokio = { version = "1.39.2", features = ["full"] }
tower = "0.4.13"
tower-http = { version = "0.5.2", features = ["fs", "trace"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [
"mssql",
] }
[workspace]
members = ["prisma-cli"]
resolver = "2" My container won't run but it builds, so hopefully it helps you past that at least? 😄 |
Hey y'all, I just spent the whole night getting my discord bot deployed on Alpine Linux on Railway and after a lot of pain, failures, 15 minute docker builds and a lot of googling and debugging I DID IT! Summary of the gotchas I found
What works for me# FROM rust:1.82.0-alpine as builder
FROM alpine:3.18 AS planner
# musl-dev is C lib
RUN apk add --no-cache musl-dev postgresql-dev gcc curl openssl-libs-static perl openssl1.1-compat libc6-compat
RUN curl -tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# prefer -proto 'https'
ENV PATH="$HOME/.cargo/bin:${PATH}"
WORKDIR /app
COPY . .
RUN cargo build --release
RUN mkdir -p bin && cp target/release/myappname bin
# # ensure we have DATABASE_URL
ARG DATABASE_URL
# other env vars
CMD ./bin/myappname From writing this post I can see many ways |
When attempting to generate prisma.rs while building an alpine-based image, the binary panics with an OS "No such file or directory" error, which occurs on the prisma_cli.rs
cmd.output().unwrap()
call, as detailed in the stack trace below.The build works fine when using a debian base image, but I wanted to use alpine since the resulting image size is 10x larger with debian.
Here is the relevant dockerfile stage:
The build output indicating the failing line:
The text was updated successfully, but these errors were encountered: