diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18b3236..c29e0f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,3 +22,9 @@ jobs: npm run build env: CI: true + - name: Docker hub publish + uses: elgohr/Publish-Docker-Github-Action@2.14 + with: + name: tikui/tikui.org + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1a9bec7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginxinc/nginx-unprivileged + +COPY ./nginx.default.d/. /etc/nginx/conf.d/. + +COPY dist /usr/share/nginx/html diff --git a/nginx.default.d/default.conf b/nginx.default.d/default.conf new file mode 100644 index 0000000..675b3fb --- /dev/null +++ b/nginx.default.d/default.conf @@ -0,0 +1,53 @@ +server { + listen 8080; + server_name localhost; + root /usr/share/nginx/html; + + location / { + index index.html index.htm; + } + + location ~ \.(css|html)$ { + expires epoch; + } + + location ~ \.(eot|otf|ttf|woff|woff2)$ { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # + # Tell client that this pre-flight info is valid for 20 days + # + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + if ($request_method = 'POST') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + } + if ($request_method = 'GET') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + } + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + location /healthcheck { + default_type 'text/plain'; + return 200 'OK'; + } +}