Skip to content

Commit 0688fe2

Browse files
author
Julio MATARRANZ
committed
feat : docker with compose fixes #16
1 parent b769419 commit 0688fe2

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM node:24-alpine3.21 AS frontend
2+
WORKDIR /app
3+
4+
COPY browser browser
5+
6+
RUN yarn global add http-server
7+
8+
RUN cd browser && \
9+
yarn install && \
10+
yarn build
11+
12+
FROM nginx:1.29.1-alpine
13+
14+
COPY --from=frontend /app/browser/dist /usr/share/nginx/html
15+
16+
RUN apk add tzdata
17+
18+
COPY nginx.conf /etc/nginx/nginx.conf
19+
COPY --from=frontend /app/browser/dist /usr/share/nginx/html
20+
RUN ls -alh /usr/share/nginx/html
21+
EXPOSE 80
22+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
nanokvm-usb:
3+
build:
4+
context: ./
5+
dockerfile: Dockerfile
6+
image: sipeed/nanokvm-usb:latest
7+
container_name: nanokvm-usb
8+
ports:
9+
- "9000:80"

nginx.conf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
worker_processes 1;
2+
3+
error_log /dev/stdout info;
4+
5+
events {
6+
worker_connections 1024;
7+
}
8+
9+
http {
10+
include mime.types;
11+
default_type application/octet-stream;
12+
sendfile on;
13+
keepalive_timeout 65;
14+
15+
server {
16+
listen 80;
17+
18+
root /usr/share/nginx/html;
19+
20+
add_header X-Frame-Options "SAMEORIGIN";
21+
add_header X-XSS-Protection "1; mode=block";
22+
add_header X-Content-Type-Options "nosniff";
23+
24+
index index.html;
25+
26+
charset utf-8;
27+
28+
location / {
29+
try_files $uri $uri/ /index.html;
30+
}
31+
32+
location = /robots.txt { access_log off; log_not_found off; }
33+
34+
location ~ /\.(?!well-known).* {
35+
deny all;
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)