mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Updated Dockerfile to support ARM
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,22 +1,22 @@
|
||||
# Builder Stage
|
||||
FROM --platform=$BUILDPLATFORM node:20-alpine AS builder
|
||||
|
||||
ARG TARGETARCH # Wird automatisch von Buildx gesetzt
|
||||
ARG TARGETARCH # Automatically set by Buildx
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
COPY ./prisma ./prisma
|
||||
|
||||
# Set PRISMA_CLI_BINARY_TARGETS based on TARGETARCH and install dependencies
|
||||
RUN case ${TARGETARCH} in \
|
||||
"amd64") export PRISMA_CLI_BINARY_TARGETS="linux-musl-x64-openssl-3.0.x" ;; \
|
||||
"arm64") export PRISMA_CLI_BINARY_TARGETS="linux-musl-arm64-openssl-3.0.x" ;; \
|
||||
"arm") export PRISMA_CLI_BINARY_TARGETS="linux-musl-arm-openssl-3.0.x" ;; \
|
||||
*) echo "Unsupported ARCH: ${TARGETARCH}" && exit 1 ;; \
|
||||
esac
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
COPY ./prisma ./prisma
|
||||
|
||||
RUN npm install
|
||||
RUN npx prisma generate
|
||||
esac && \
|
||||
npm install && \
|
||||
npx prisma generate
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
@@ -27,8 +27,8 @@ FROM --platform=$TARGETPLATFORM node:20-alpine AS production
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV production
|
||||
ENV PRISMA_CLI_BINARY_TARGETS="linux-musl-arm64-openssl-3.0.x"
|
||||
|
||||
# Copy built assets and dependencies from builder
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/.next ./.next
|
||||
@@ -36,16 +36,18 @@ COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/next.config.js* ./
|
||||
|
||||
# Prune dev dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["sh", "-c", "npx prisma migrate deploy && npm start"]
|
||||
|
||||
|
||||
# - - BUILD COMMAND - -
|
||||
# docker buildx build \
|
||||
# --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
||||
# -t haedlessdev/corecontrol:1.0.0 \
|
||||
# -t haedlessdev/corecontrol:latest \
|
||||
# --push \
|
||||
# .
|
||||
# Dynamically set PRISMA_CLI_BINARY_TARGETS based on runtime architecture and start
|
||||
CMD ["sh", "-c", \
|
||||
"export PRISMA_CLI_BINARY_TARGETS=$(case $(uname -m) in \
|
||||
x86_64) echo 'linux-musl-x64-openssl-3.0.x' ;; \
|
||||
aarch64) echo 'linux-musl-arm64-openssl-3.0.x' ;; \
|
||||
armv7l) echo 'linux-musl-arm-openssl-3.0.x' ;; \
|
||||
*) echo "Unsupported architecture: $(uname -m)" && exit 1 ;; \
|
||||
esac) && \
|
||||
npx prisma migrate deploy && \
|
||||
npm start"]
|
||||
Reference in New Issue
Block a user