-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (50 loc) · 1.91 KB
/
Dockerfile
File metadata and controls
56 lines (50 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Multi-stage build using Node 25.2.1
FROM node:25.2.1 AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY tsconfig.json tsconfig.eslint.json vite.config.ts postcss.config.js tailwind.config.ts components.json ./
COPY public ./public
COPY client ./client
COPY server ./server
COPY shared ./shared
RUN npm run build
########################################
# Production image
FROM node:25.2.1-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV ARDUINO_CACHE_DIR=/app/server/arduino-cache
# 1. Installiere System-Tools UND Docker-CLI
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
tar \
xz-utils \
g++ \
gnupg \
lsb-release \
&& mkdir -p -m 0755 /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce-cli \
# 2. Arduino CLI Installation
&& curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh \
&& arduino-cli config init \
&& arduino-cli core update-index \
&& arduino-cli core install arduino:avr \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app/server/arduino-cache /app/storage/binaries /app/temp
# Copy built artifacts
COPY --from=builder /app/dist ./dist
# Copy package metadata and install dependencies
COPY package.json package-lock.json ./
RUN npm install --legacy-peer-deps --production=false \
&& chown -R node:node /app
# Run as non-root user for production
# node:slim already provides a 'node' user at UID 1000
USER node
EXPOSE 3000
CMD ["npm", "run", "start"]