generated from ds-wizard/dsw-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (31 loc) · 1021 Bytes
/
Dockerfile
File metadata and controls
44 lines (31 loc) · 1021 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# ---------- Builder stage ----------
FROM node:24-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm install
# Copy source and build
COPY . .
RUN npm run build
# ---------- Nginx (rootless) stage ----------
FROM nginx:1-alpine
# Create non-root user and group
RUN addgroup -S app && adduser -S app -G app
# Remove default nginx static content
RUN rm -rf /usr/share/nginx/html/*
# Copy build output
COPY --from=builder /app/dist /usr/share/nginx/html
# Custom nginx config (listening on 8080)
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
# Ensure permissions for non-root user
RUN chown -R nginx:nginx /usr/share/nginx/html \
&& chmod -R 755 /usr/share/nginx/html \
&& chown -R nginx:nginx /var/cache/nginx \
&& chown -R nginx:nginx /var/log/nginx \
&& chown -R nginx:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid \
&& chown -R nginx:nginx /var/run/nginx.pid
# Run as non-root
USER nginx
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]