From 0688fe2c6f36a184e028c99188c1c68b7cf841cf Mon Sep 17 00:00:00 2001 From: Julio MATARRANZ Date: Thu, 4 Sep 2025 18:38:11 +0200 Subject: [PATCH] feat : docker with compose fixes #16 --- Dockerfile | 22 ++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ nginx.conf | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fdbfce0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:24-alpine3.21 AS frontend +WORKDIR /app + +COPY browser browser + +RUN yarn global add http-server + +RUN cd browser && \ + yarn install && \ + yarn build + +FROM nginx:1.29.1-alpine + +COPY --from=frontend /app/browser/dist /usr/share/nginx/html + +RUN apk add tzdata + +COPY nginx.conf /etc/nginx/nginx.conf +COPY --from=frontend /app/browser/dist /usr/share/nginx/html +RUN ls -alh /usr/share/nginx/html +EXPOSE 80 +ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5a0fb5a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + nanokvm-usb: + build: + context: ./ + dockerfile: Dockerfile + image: sipeed/nanokvm-usb:latest + container_name: nanokvm-usb + ports: + - "9000:80" \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f3cbcf9 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,38 @@ +worker_processes 1; + +error_log /dev/stdout info; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + + root /usr/share/nginx/html; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + + index index.html; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.html; + } + + location = /robots.txt { access_log off; log_not_found off; } + + location ~ /\.(?!well-known).* { + deny all; + } + } +} \ No newline at end of file