feat(Dockerfile): add Nginx as a proxy server

This commit is contained in:
Franek 2025-06-01 00:04:59 +02:00
parent c2daa82ecc
commit 9c80ae080d
2 changed files with 15 additions and 9 deletions

View File

@ -7,14 +7,11 @@ RUN cargo install dioxus-cli
WORKDIR /app
COPY . ./
RUN dx build --release --features web
RUN cargo build --release --features server
RUN dx bundle --platform web
FROM debian:bookworm-slim
FROM nginx
COPY --from=builder /app/target/dx/personal-website/release/web/public /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/local/bin/dist
COPY --from=builder /app/target/release/personal-website /usr/local/bin/dist
EXPOSE 8080
WORKDIR /usr/local/bin/
CMD ["./dist/personal-website"]
EXPOSE 80
CMD [ "nginx", "-g", "daemon off;" ]

9
nginx.conf Normal file
View File

@ -0,0 +1,9 @@
server {
listen 80;
location / {
root /usr/share/nginx/html/;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
}