Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6de8cd46df | |||
| 61540905dd | |||
| bea3342042 | |||
| 95317884ff | |||
| ca0dbd0e63 |
+8
-4
@@ -9,13 +9,17 @@ RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production
|
||||
FROM nginx:stable-alpine AS prod
|
||||
# Stage 2: Production — uses nginxinc/nginx-unprivileged which runs as non-root (UID 101)
|
||||
FROM nginxinc/nginx-unprivileged:stable-alpine AS prod
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
# Explicitly declare numeric UID 101 (nginx-unprivileged's nginx user) so
|
||||
# Kubernetes can verify runAsNonRoot without resolving string usernames.
|
||||
USER 101
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -qO- http://localhost/health || exit 1
|
||||
CMD wget -qO- http://localhost:8080/health || exit 1
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen 8080;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
Reference in New Issue
Block a user