mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Updated Dockerfiles for ARM Support
This commit is contained in:
42
Dockerfile
42
Dockerfile
@@ -1,47 +1,51 @@
|
||||
# Builder Stage
|
||||
FROM node:20-alpine AS builder
|
||||
FROM --platform=$BUILDPLATFORM node:20-alpine AS builder
|
||||
|
||||
ARG TARGETARCH # Wird automatisch von Buildx gesetzt
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
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
|
||||
|
||||
# Install all dependencies (including devDependencies)
|
||||
RUN npm install
|
||||
|
||||
# Generate Prisma client
|
||||
RUN npx prisma generate
|
||||
|
||||
# Build the application
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Production Stage
|
||||
FROM node:20-alpine AS production
|
||||
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 package files
|
||||
COPY package.json package-lock.json* ./
|
||||
|
||||
# Copy node_modules from builder
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Remove dev dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
# Copy Prisma files
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
|
||||
# Copy built application
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/next.config.js* ./
|
||||
|
||||
EXPOSE 3000
|
||||
RUN npm prune --production
|
||||
|
||||
# Run migrations and start
|
||||
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 \
|
||||
# .
|
||||
Reference in New Issue
Block a user