Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleds committed Dec 7, 2022
1 parent 365b9ea commit a6a04dc
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.docusaurus

/build
/node_modules
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:16 AS builder
WORKDIR /app

# Install dependencies
COPY package.json package-lock.json /app
RUN npm ci --ignore-scripts

# Build site
COPY . /app
ENV NODE_OPTIONS=--max_old_space_size=3072
RUN npm run build

# ==== Final image ====
FROM nginx
COPY provisioning/nginx/nginx.conf /etc/nginx/nginx.conf
COPY provisioning/nginx/redirects.map /etc/nginx/redirects.map
COPY --from=builder /app/build/ /usr/share/nginx/html

EXPOSE 80
80 changes: 80 additions & 0 deletions provisioning/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

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;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
gzip_min_length 1000;
gzip_proxied no-cache no-store private expired auth;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-font-opentype
application/x-font-truetype
application/x-javascript
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/eot
font/opentype
font/otf
image/svg+xml
image/x-icon
image/vnd.microsoft.icon
text/css
text/plain
text/javascript
text/x-component;

map_hash_bucket_size 256; # see http://nginx.org/en/docs/hash.html

map $request_uri $new_uri {
include /etc/nginx/redirects.map;
}

server {
listen 80;
server_name localhost;

if ($new_uri) {
return 301 $new_uri;
}

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

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
1 change: 1 addition & 0 deletions provisioning/nginx/redirects.map
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/display/FREESWITCH/Index /docs;

0 comments on commit a6a04dc

Please sign in to comment.