fix(docker): build prisma so it works on alpine arm64
This commit is contained in:
parent
2dfa1b6b14
commit
0ba9a9659d
1 changed files with 30 additions and 8 deletions
38
Dockerfile
38
Dockerfile
|
@ -1,16 +1,32 @@
|
||||||
FROM frolvlad/alpine-glibc AS deps
|
FROM rust:1.58.1-alpine3.14 as prisma
|
||||||
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
|
RUN apk --no-cache add openssl direnv git musl-dev openssl-dev build-base perl protoc
|
||||||
|
RUN git clone --depth=1 --branch=3.15.x https://github.com/prisma/prisma-engines.git /prisma
|
||||||
|
WORKDIR /prisma
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
FROM alpine:3.16 AS deps
|
||||||
|
RUN mkdir -p /prisma-engines
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
COPY .yarn .yarn
|
COPY .yarn .yarn
|
||||||
COPY package.json yarn.lock .yarnrc.yml ./
|
COPY package.json yarn.lock .yarnrc.yml ./
|
||||||
|
|
||||||
RUN apk add --no-cache libc6-compat nodejs yarn
|
RUN apk add --no-cache nodejs yarn
|
||||||
RUN yarn install --immutable
|
RUN yarn install --immutable
|
||||||
|
|
||||||
FROM frolvlad/alpine-glibc AS builder
|
FROM alpine:3.16 AS builder
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
RUN apk add --no-cache nodejs yarn libc6-compat openssl openssl-dev
|
COPY --from=prisma /prisma/target/release/query-engine /prisma/target/release/migration-engine /prisma/target/release/introspection-engine /prisma/target/release/prisma-fmt /prisma-engines/
|
||||||
|
ENV PRISMA_QUERY_ENGINE_BINARY=/prisma-engines/query-engine \
|
||||||
|
PRISMA_MIGRATION_ENGINE_BINARY=/prisma-engines/migration-engine \
|
||||||
|
PRISMA_INTROSPECTION_ENGINE_BINARY=/prisma-engines/introspection-engine \
|
||||||
|
PRISMA_FMT_BINARY=/prisma-engines/prisma-fmt \
|
||||||
|
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
|
||||||
|
PRISMA_CLIENT_ENGINE_TYPE=binary
|
||||||
|
|
||||||
|
RUN apk add --no-cache nodejs yarn openssl openssl-dev
|
||||||
|
|
||||||
COPY --from=deps /build/node_modules ./node_modules
|
COPY --from=deps /build/node_modules ./node_modules
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
@ -22,14 +38,20 @@ COPY package.json yarn.lock .yarnrc.yml esbuild.config.js next.config.js next-en
|
||||||
ENV ZIPLINE_DOCKER_BUILD 1
|
ENV ZIPLINE_DOCKER_BUILD 1
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN cat prisma/schema.prisma
|
|
||||||
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM frolvlad/alpine-glibc AS runner
|
FROM alpine:3.16 AS runner
|
||||||
WORKDIR /zipline
|
WORKDIR /zipline
|
||||||
|
|
||||||
RUN apk add --no-cache nodejs yarn libc6-compat openssl openssl-dev
|
COPY --from=prisma /prisma/target/release/query-engine /prisma/target/release/migration-engine /prisma/target/release/introspection-engine /prisma/target/release/prisma-fmt /prisma-engines/
|
||||||
|
ENV PRISMA_QUERY_ENGINE_BINARY=/prisma-engines/query-engine \
|
||||||
|
PRISMA_MIGRATION_ENGINE_BINARY=/prisma-engines/migration-engine \
|
||||||
|
PRISMA_INTROSPECTION_ENGINE_BINARY=/prisma-engines/introspection-engine \
|
||||||
|
PRISMA_FMT_BINARY=/prisma-engines/prisma-fmt \
|
||||||
|
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
|
||||||
|
PRISMA_CLIENT_ENGINE_TYPE=binary
|
||||||
|
|
||||||
|
RUN apk add --no-cache nodejs yarn openssl openssl-dev
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue