Compare commits
3
Commits
pr107-fix
...
b8b8ca7163
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8b8ca7163 | ||
|
|
8efa034f9c | ||
|
|
39b1daea51 |
@@ -0,0 +1,47 @@
|
||||
# ==================
|
||||
# Étape 1 : Build
|
||||
# ==================
|
||||
|
||||
# Image pour frontend
|
||||
FROM dhi.io/node:24-alpine3.22-dev AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
|
||||
# Installation des dépendances du projet avec npm
|
||||
RUN --mount=type=cache,target=/root/.npm npm ci
|
||||
|
||||
# Copie du code source vers le conteneur
|
||||
COPY . .
|
||||
|
||||
# Build
|
||||
RUN npm run build
|
||||
|
||||
# ==================
|
||||
# Étape 2 : Runner
|
||||
# ==================
|
||||
|
||||
|
||||
FROM dhi.io/nginx:1.28.0-alpine3.21-dev AS runner
|
||||
|
||||
# Copie de la configuration de nginx
|
||||
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy the static build output from the build stage to Nginx's default HTML serving directory
|
||||
COPY --chown=nginx:nginx --from=builder /app/dist/*/browser /usr/share/nginx/html
|
||||
|
||||
# Create necessary directories with proper permissions for nginx
|
||||
RUN mkdir -p /var/log/nginx /var/cache/nginx && \
|
||||
chown -R nginx:nginx /var/log/nginx /var/cache/nginx /usr/share/nginx/html
|
||||
|
||||
# Use a non-root user for security best practices
|
||||
USER nginx
|
||||
|
||||
# Frontend : port 3000
|
||||
# Backend : port 8000
|
||||
EXPOSE 3000
|
||||
|
||||
# Start Nginx directly with custom config
|
||||
ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"]
|
||||
CMD ["-g", "daemon off;"]
|
||||
@@ -0,0 +1,32 @@
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user