Dockerfile & nginx configurations

This commit is contained in:
2023-05-19 18:08:58 +02:00
parent 445e0eb768
commit b20661dc20
2 changed files with 87 additions and 0 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM ruby:3.1-slim-bullseye as jekyll
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt
COPY . .
RUN gem update --system && gem install jekyll bundler
# RUN gem update --system && gem install jekyll && gem cleanup
RUN bundle install && jekyll build
ENTRYPOINT [ "jekyll" ]
CMD [ "--help" ]
# build from the image we just built with different metadata
FROM nginx:alpine
WORKDIR /app
COPY nginx.conf /etc/nginx
COPY --from=jekyll /opt/_site .

60
nginx.conf Normal file
View File

@@ -0,0 +1,60 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
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_vary on;
gzip_types text/html text/plain text/css text/xml text/javascript application/javascript application/xml;
server {
listen 4000;
listen [::]:4000;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /app;
default_type "text/html";
index index.html index.htm;
if ($request_uri ~ ^/(.*)\.html(\?|$)) {
return 302 /$1;
}
try_files $uri $uri.html $uri/ =404;
}
#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;
}
}
}