From 24c2d336bb9602521420614eb348070eefd63ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Fri, 26 Jul 2024 17:23:02 +0200 Subject: [PATCH] Replace nginx with caddy --- Caddyfile | 13 +++++++++++++ Dockerfile | 7 +++---- nginx/default.conf | 14 -------------- 3 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 Caddyfile delete mode 100644 nginx/default.conf diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..79f251e --- /dev/null +++ b/Caddyfile @@ -0,0 +1,13 @@ +{ + auto_https off + servers { + trusted_proxies static private_ranges + } +} + +http://racemash.maciejpedzi.ch { + root * /srv + encode gzip + try_files {path} /index.html + file_server +} diff --git a/Dockerfile b/Dockerfile index 0b018ef..16cfbd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,7 @@ COPY . . RUN npm i RUN npm run build -FROM nginx:stable-alpine AS runtime -COPY --from=build /app/nginx/default.conf /etc/nginx/conf.d/default.conf -COPY --from=build /app/dist /usr/share/nginx/html +FROM caddy:2.8 AS runtime +COPY --from=build /app/Caddyfile /etc/caddy/Caddyfile +COPY --from=build /app/dist /srv EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/default.conf b/nginx/default.conf deleted file mode 100644 index 061151e..0000000 --- a/nginx/default.conf +++ /dev/null @@ -1,14 +0,0 @@ -server { - listen 80; - server_name racemash.maciejpedzi.ch; - root /usr/share/nginx/html; - index index.html index.htm; - - location /images { - root /usr/share/nginx/html; - } - - location / { - try_files $uri $uri/ /index.html; - } -}