Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dweber019 committed Oct 19, 2023
1 parent d4917eb commit c75dd38
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 36 deletions.
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ COPY . /app
RUN npm install
RUN npm run build

FROM nginx:stable-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/nginx.conf
FROM nginx:1.23-alpine

COPY nginx/nginx.conf /etc/nginx/

COPY nginx/default.conf \
nginx/file-browser.conf \
/etc/nginx/conf.d/

RUN chmod -R 777 /etc/nginx/ && \
chown -R nginx:0 /var/cache/nginx && \
chmod -R g+w /var/cache/nginx && \
rm /usr/share/nginx/html/*

EXPOSE 8080
CMD ["nginx","-g","daemon off;"]
USER nginx

COPY --from=build /app/dist /usr/share/nginx/html/
19 changes: 19 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# default config for single-page apps
server {
listen 8080;
root /usr/share/nginx/html;

location ~ ^/(css|js)/ {
# These assets include a unique hash in the filename, so they will never change
expires max;
}

location ~* ^.+\.(html]htm)$ {
# Very short caching time to ensure changes are immediately recognized
expires 5m;
}

location / {
try_files $uri $uri/ /index.html =404;
}
}
8 changes: 8 additions & 0 deletions nginx/file-browser.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 8080;
root /usr/share/nginx/html;

location / {
autoindex on;
}
}
56 changes: 24 additions & 32 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
user www www; ## Default: nobody
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/cache/nginx/nginx.pid;

events {
worker_connections 4096; ## Default: 1024
worker_connections 1024;
}

http {
index index.html index.htm index.php;

client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts

server {
listen 8080;server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
}
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 off;

sendfile on;

keepalive_timeout 65;

gzip on;
gzip_static on;
gzip_types text/plain text/css text/javascript application/javascript application/xml application/pdf image/svg+xml;

include /etc/nginx/conf.d/default.conf;

0 comments on commit c75dd38

Please sign in to comment.