-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (54 loc) · 1.67 KB
/
Dockerfile
File metadata and controls
65 lines (54 loc) · 1.67 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
57
58
59
60
61
62
63
64
65
#############################################
# base
#############################################
FROM node:24-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
#############################################
# Builder web
#############################################
FROM base AS build
ARG VERSION="develop"
ARG BUILD_VERSION="unkown"
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN VITE_APP_VERSION="${VERSION}" VITE_BUILD_VERSION="${BUILD_VERSION}" pnpm run build
#############################################
# Nginx
#############################################
FROM nginx:1.29 AS runner
RUN rm -f /etc/nginx/conf.d/default.conf && rm -rf /etc/nginx/templates/*
RUN cat > /etc/nginx/nginx.conf <<'EOF'
worker_processes auto;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_body_temp_path /var/cache/nginx/client_temp;
proxy_temp_path /var/cache/nginx/proxy_temp;
fastcgi_temp_path /var/cache/nginx/fastcgi_temp;
uwsgi_temp_path /var/cache/nginx/uwsgi_temp;
scgi_temp_path /var/cache/nginx/scgi_temp;
include /etc/nginx/conf.d/*.conf;
}
EOF
RUN cat > /etc/nginx/conf.d/site.conf <<'EOF'
server {
listen 8080;
listen [::]:8080;
location /status {
stub_status on;
access_log off;
}
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
EOF
COPY --from=build /app/dist /usr/share/nginx/html