From a5357f0260f1c260386b619bd148c6c255423228 Mon Sep 17 00:00:00 2001 From: Yong Sheng Tan Date: Sat, 9 Mar 2024 12:24:54 +0800 Subject: [PATCH] Test slim build --- Dockerfile | 20 ++++++++++++++++++-- nginx/nginx.conf | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 nginx/nginx.conf diff --git a/Dockerfile b/Dockerfile index 4964820..0e149c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,21 @@ -FROM nginx:stable -RUN rm -rf /etc/nginx/conf.d +FROM ubuntu:mantic as builder +ARG CHISEL_VER=0.9.0 +WORKDIR /opt +ADD https://github.com/canonical/chisel/releases/download/v${CHISEL_VER}/chisel_v${CHISEL_VER}_linux_arm64.tar.gz chisel.tar.gz +RUN apt update \ + && apt install -y ca-certificates \ + && tar -xvf chisel.tar.gz -C /usr/bin/ \ + && mkdir rootfs \ + && install -d -m 0755 -o 33 -g 33 rootfs/var/www +RUN chisel cut --release ubuntu-23.10 --root $PWD/rootfs \ + base-files_var \ + base-passwd_data \ + nginx_bins \ + nginx-common_index +RUN rm -rf /opt/rootfs/etc/nginx/nginx.conf + +FROM scratch +COPY --from=builder /opt/rootfs / COPY nginx /etc/nginx COPY dist /usr/share/nginx/html EXPOSE 80 diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..97a680e --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,22 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +error_log /var/log/nginx/error.log; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; +} + +http { + sendfile on; + tcp_nopush on; + types_hash_max_size 2048; + include /etc/nginx/mime.types; + default_type application/octet-stream; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_prefer_server_ciphers on; + access_log /var/log/nginx/access.log; + gzip on; + include /etc/nginx/conf.d/*.conf; +}