mirror of
https://github.com/simon987/toolbox.git
synced 2025-12-13 23:39:05 +00:00
Dockerize
This commit is contained in:
1
toolbox-web/.dockerignore
Normal file
1
toolbox-web/.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
**/node_modules
|
||||
14
toolbox-web/Dockerfile
Normal file
14
toolbox-web/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM node:10 as build
|
||||
|
||||
COPY ./ /app
|
||||
|
||||
WORKDIR app
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=build /app/dist /webroot
|
||||
COPY nginx.conf /etc/nginx/
|
||||
|
||||
EXPOSE 80
|
||||
45
toolbox-web/nginx.conf
Normal file
45
toolbox-web/nginx.conf
Normal file
@@ -0,0 +1,45 @@
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
upstream api {
|
||||
server toolbox_api:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
index index.html;
|
||||
root /webroot;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ /api(.*)$ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://api$1?$args;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
export const API_URL = "http://localhost:8000"
|
||||
export const API_URL = window.location.protocol + '//' + window.location.host + '/api';
|
||||
|
||||
Reference in New Issue
Block a user