-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 721 Bytes
/
Copy pathDockerfile
File metadata and controls
30 lines (21 loc) · 721 Bytes
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
# Build stage
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json ./
# Hinweis: npm ci mit package-lock.json verwenden, sobald verfügbar
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM nginx:alpine
# Copy nginx config and built files with correct ownership
COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf
COPY --chown=nginx:nginx --from=build /app/dist /usr/share/nginx/html
# Ensure nginx runtime directories are writable by non-root user
RUN chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
touch /var/run/nginx.pid && \
chown nginx:nginx /var/run/nginx.pid
USER nginx
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]