Skip to content

Commit

Permalink
feat: docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
oats authored and LynnL4 committed Jan 17, 2024
1 parent 1d54d38 commit 36eb6b0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:16-alpine3.14 as builder

RUN apk add --no-cache yarn git autoconf automake libtool g++ make libpng-dev file nasm

RUN git clone https://github.com/Seeed-Studio/SenseCraft-Web-Toolkit.git /usr/SenseCraft-Web-Toolkit

WORKDIR /usr/SenseCraft-Web-Toolkit/

RUN yarn install \
&& yarn run build

COPY default/nginx-default.conf /usr/SenseCraft-Web-Toolkit/nginx-default.conf

FROM nginx as runner
COPY --from=builder /usr/SenseCraft-Web-Toolkit/dist /usr/share/nginx/html/
COPY --from=builder /usr/SenseCraft-Web-Toolkit/nginx-default.conf /etc/nginx/conf.d/default.conf
31 changes: 31 additions & 0 deletions docker/default/nginx-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 80;
server_name localhost;

#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log error;

#gzip
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_http_version 1.0;
gzip_types application/javascript text/css text/xml application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml;
gzip_vary on;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 36eb6b0

Please sign in to comment.