「✨」 feat: Should be working
This commit is contained in:
@ -4,22 +4,37 @@ ADD docker/alpine/alpine-minirootfs-3.21.2-x86_64.tar.gz /
|
||||
LABEL version="0.1"
|
||||
LABEL maintainer="KeyZox"
|
||||
|
||||
COPY go.mod /build/go.mod
|
||||
COPY cmd /build/cmd
|
||||
COPY internal /build/internal
|
||||
|
||||
RUN set -x \
|
||||
&& addgroup -g 101 -S nginx\
|
||||
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
|
||||
&& apk add --no-cache nginx tzdata \
|
||||
&& apk add --no-cache go nginx openssl tzdata envsubst curl \
|
||||
&& cd /build \
|
||||
&& go get git.keyzox.me/42_adjoly/inception/cmd/nginx/entrypoint \
|
||||
&& go build git.keyzox.me/42_adjoly/inception/cmd/nginx/entrypoint \
|
||||
&& cp /build/entrypoint /docker-entrypoint \
|
||||
&& chmod +x /docker-entrypoint \
|
||||
&& apk del go \
|
||||
&& ln -sf /dev/stdout /var/log/nginx/access.log \
|
||||
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
&& ln -sf /dev/stderr /var/log/nginx/error.log \
|
||||
&& rm -Rf /build \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& mkdir -p /var/www/html \
|
||||
&& mkdir -p /etc/nginx/conf.d \
|
||||
&& mkdir /docker-entrypoint.d
|
||||
|
||||
VOLUME /etc/nginx
|
||||
RUN mkdir -p /etc/nginx/sites-available
|
||||
|
||||
COPY docker-healthcheck.sh /docker-healthcheck.sh
|
||||
RUN chmod +x /docker-healthcheck.sh
|
||||
VOLUME /etc/nginx/templates
|
||||
VOLUME /docker-entrypoint.d
|
||||
COPY docker/nginx/health.conf /etc/nginx/http.d/health.conf
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint" ]
|
||||
WORKDIR /etc/nginx
|
||||
|
||||
STOPSIGNAL SIGQUIT
|
||||
|
||||
EXPOSE 80
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD /docker-healthcheck.sh
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=1s --start-interval=2s CMD curl http://127.0.0.1:80/health || exit 1
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
curl -f http://localhost/health || exit 1
|
9
srcs/docker/nginx/health.conf
Normal file
9
srcs/docker/nginx/health.conf
Normal file
@ -0,0 +1,9 @@
|
||||
server {
|
||||
listen 127.0.0.1:80;
|
||||
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 'healthy';
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
access_log /var/log/nginx/access.log;
|
||||
keepalive_timeout 3000;
|
||||
server {
|
||||
listen 80;
|
||||
root /www;
|
||||
index index.php index.html index.htm;
|
||||
server_name localhost;
|
||||
client_max_body_size 32m;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /var/lib/nginx/html;
|
||||
}
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user