This commit is contained in:
root
2025-12-14 10:39:18 +03:00
commit 639f4e2b4e
179 changed files with 21065 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
FROM dollhouse-base:latest AS frontend-builder
RUN wget https://github.com/trunk-rs/trunk/releases/download/v0.21.14/trunk-x86_64-unknown-linux-gnu.tar.gz && \
tar -xvf trunk-x86_64-unknown-linux-gnu.tar.gz && \
mv trunk /usr/local/bin/ && \
rm trunk-x86_64-unknown-linux-gnu.tar.gz
RUN rustup target add wasm32-unknown-unknown
COPY . .
RUN cd crates/dollhouse-frontend && trunk build --release --no-sri
FROM nginx:1.24-alpine AS runtime
COPY --from=frontend-builder /app/crates/dollhouse-frontend/dist /usr/share/nginx/html
COPY docker/dollhouse-frontend/nginx.conf /etc/nginx/nginx.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,53 @@
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 3000;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location /api/ {
proxy_pass http://backend:5555/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# CORS headers
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept" always;
add_header Access-Control-Allow-Credentials "true" always;
# Handle preflight
if ($request_method = OPTIONS) {
return 204;
}
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
location ~* \.(wasm)$ {
add_header Content-Type application/wasm;
default_type application/wasm;
expires max;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.html;
}
}
}