Updated Dockerfile to support ARM

This commit is contained in:
headlessdev 2025-04-30 18:35:22 +02:00
parent cf177d587c
commit c624ddafb2
3 changed files with 53 additions and 66 deletions

View File

@ -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"]

79
package-lock.json generated
View File

@ -55,7 +55,7 @@
"@types/react-dom": "^19",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.3",
"prisma": "^6.6.0",
"prisma": "^6.7.0",
"tailwindcss": "^4.1.4",
"tsx": "^4.19.3",
"typescript": "^5"
@ -1174,9 +1174,9 @@
}
},
"node_modules/@prisma/config": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.6.0.tgz",
"integrity": "sha512-d8FlXRHsx72RbN8nA2QCRORNv5AcUnPXgtPvwhXmYkQSMF/j9cKaJg+9VcUzBRXGy9QBckNzEQDEJZdEOZ+ubA==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.7.0.tgz",
"integrity": "sha512-di8QDdvSz7DLUi3OOcCHSwxRNeW7jtGRUD2+Z3SdNE3A+pPiNT8WgUJoUyOwJmUr5t+JA2W15P78C/N+8RXrOA==",
"devOptional": true,
"license": "Apache-2.0",
"dependencies": {
@ -1185,30 +1185,30 @@
}
},
"node_modules/@prisma/debug": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.6.0.tgz",
"integrity": "sha512-DL6n4IKlW5k2LEXzpN60SQ1kP/F6fqaCgU/McgaYsxSf43GZ8lwtmXLke9efS+L1uGmrhtBUP4npV/QKF8s2ZQ==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.7.0.tgz",
"integrity": "sha512-RabHn9emKoYFsv99RLxvfG2GHzWk2ZI1BuVzqYtmMSIcuGboHY5uFt3Q3boOREM9de6z5s3bQoyKeWnq8Fz22w==",
"devOptional": true,
"license": "Apache-2.0"
},
"node_modules/@prisma/engines": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.6.0.tgz",
"integrity": "sha512-nC0IV4NHh7500cozD1fBoTwTD1ydJERndreIjpZr/S3mno3P6tm8qnXmIND5SwUkibNeSJMpgl4gAnlqJ/gVlg==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.7.0.tgz",
"integrity": "sha512-3wDMesnOxPrOsq++e5oKV9LmIiEazFTRFZrlULDQ8fxdub5w4NgRBoxtWbvXmj2nJVCnzuz6eFix3OhIqsZ1jw==",
"devOptional": true,
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@prisma/debug": "6.6.0",
"@prisma/engines-version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a",
"@prisma/fetch-engine": "6.6.0",
"@prisma/get-platform": "6.6.0"
"@prisma/debug": "6.7.0",
"@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed",
"@prisma/fetch-engine": "6.7.0",
"@prisma/get-platform": "6.7.0"
}
},
"node_modules/@prisma/engines-version": {
"version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a.tgz",
"integrity": "sha512-JzRaQ5Em1fuEcbR3nUsMNYaIYrOT1iMheenjCvzZblJcjv/3JIuxXN7RCNT5i6lRkLodW5ojCGhR7n5yvnNKrw==",
"version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed.tgz",
"integrity": "sha512-EvpOFEWf1KkJpDsBCrih0kg3HdHuaCnXmMn7XFPObpFTzagK1N0Q0FMnYPsEhvARfANP5Ok11QyoTIRA2hgJTA==",
"devOptional": true,
"license": "Apache-2.0"
},
@ -1224,25 +1224,25 @@
}
},
"node_modules/@prisma/fetch-engine": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.6.0.tgz",
"integrity": "sha512-Ohfo8gKp05LFLZaBlPUApM0M7k43a0jmo86YY35u1/4t+vuQH9mRGU7jGwVzGFY3v+9edeb/cowb1oG4buM1yw==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.7.0.tgz",
"integrity": "sha512-zLlAGnrkmioPKJR4Yf7NfW3hftcvqeNNEHleMZK9yX7RZSkhmxacAYyfGsCcqRt47jiZ7RKdgE0Wh2fWnm7WsQ==",
"devOptional": true,
"license": "Apache-2.0",
"dependencies": {
"@prisma/debug": "6.6.0",
"@prisma/engines-version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a",
"@prisma/get-platform": "6.6.0"
"@prisma/debug": "6.7.0",
"@prisma/engines-version": "6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed",
"@prisma/get-platform": "6.7.0"
}
},
"node_modules/@prisma/get-platform": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.6.0.tgz",
"integrity": "sha512-3qCwmnT4Jh5WCGUrkWcc6VZaw0JY7eWN175/pcb5Z6FiLZZ3ygY93UX0WuV41bG51a6JN/oBH0uywJ90Y+V5eA==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.7.0.tgz",
"integrity": "sha512-i9IH5lO4fQwnMLvQLYNdgVh9TK3PuWBfQd7QLk/YurnAIg+VeADcZDbmhAi4XBBDD+hDif9hrKyASu0hbjwabw==",
"devOptional": true,
"license": "Apache-2.0",
"dependencies": {
"@prisma/debug": "6.6.0"
"@prisma/debug": "6.7.0"
}
},
"node_modules/@radix-ui/number": {
@ -4577,15 +4577,15 @@
"license": "MIT"
},
"node_modules/prisma": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-6.6.0.tgz",
"integrity": "sha512-SYCUykz+1cnl6Ugd8VUvtTQq5+j1Q7C0CtzKPjQ8JyA2ALh0EEJkMCS+KgdnvKW1lrxjtjCyJSHOOT236mENYg==",
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-6.7.0.tgz",
"integrity": "sha512-vArg+4UqnQ13CVhc2WUosemwh6hr6cr6FY2uzDvCIFwH8pu8BXVv38PktoMLVjtX7sbYThxbnZF5YiR8sN2clw==",
"devOptional": true,
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@prisma/config": "6.6.0",
"@prisma/engines": "6.6.0"
"@prisma/config": "6.7.0",
"@prisma/engines": "6.7.0"
},
"bin": {
"prisma": "build/index.js"
@ -5208,21 +5208,6 @@
"optional": true
}
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "15.3.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.3.0.tgz",
"integrity": "sha512-vHUQS4YVGJPmpjn7r5lEZuMhK5UQBNBRSB+iGDvJjaNk649pTIcRluDWNb9siunyLLiu/LDPHfvxBtNamyuLTw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
}
}
}

View File

@ -56,7 +56,7 @@
"@types/react-dom": "^19",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.3",
"prisma": "^6.6.0",
"prisma": "^6.7.0",
"tailwindcss": "^4.1.4",
"tsx": "^4.19.3",
"typescript": "^5"