Add nginx to dockerfile and deploy a static index.html.
This commit is contained in:
parent
dea76746a6
commit
57c38f5457
@ -1,6 +1,10 @@
|
||||
FROM harbor.fizz.buzz/dockerhub/library/python:3.9
|
||||
FROM harbor.fizz.buzz/dockerhub/library/alpine:3.18
|
||||
|
||||
RUN useradd -m -g nogroup server
|
||||
USER server
|
||||
RUN apk add --no-cache bash nginx
|
||||
RUN addgroup web && adduser -D -G web web && install -d -D -o web -g web -m 700 /srv/http/public
|
||||
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
CMD ["python", "-c", "print('worked')"]
|
||||
COPY --chown=web:web docker/nginx.conf /srv/http
|
||||
COPY --chown=web:web static/ /srv/http/public/
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/nginx", "-c", "/srv/http/nginx.conf", "-e", "stderr", "-g", "daemon off;"]
|
||||
|
35
docker/server/Makefile
Normal file
35
docker/server/Makefile
Normal file
@ -0,0 +1,35 @@
|
||||
IMAGE_NAME:=homepage
|
||||
# REMOTE_REPO:=harbor.fizz.buzz/private
|
||||
|
||||
.PHONY: all
|
||||
all: build push
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
docker build -t $(IMAGE_NAME) -f Dockerfile ../
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
ifdef REMOTE_REPO
|
||||
docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
docker push $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
else
|
||||
@echo "REMOTE_REPO not defined, not pushing to a remote repo."
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
docker rmi $(IMAGE_NAME)
|
||||
ifdef REMOTE_REPO
|
||||
docker rmi $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
else
|
||||
@echo "REMOTE_REPO not defined, not removing from remote repo."
|
||||
endif
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
docker run --rm -i -t -p "8080:8080" $(IMAGE_NAME)
|
||||
|
||||
.PHONY: shell
|
||||
shell:
|
||||
docker run --rm -i -t -p "8080:8080" --entrypoint /bin/bash $(IMAGE_NAME)
|
40
docker/server/nginx.conf
Normal file
40
docker/server/nginx.conf
Normal file
@ -0,0 +1,40 @@
|
||||
user web;
|
||||
worker_processes 4;
|
||||
|
||||
# Speed up regular expressions.
|
||||
pcre_jit on;
|
||||
|
||||
error_log stderr debug;
|
||||
|
||||
events {
|
||||
# Connections per worker process.
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
server_tokens off;
|
||||
client_max_body_size 1m;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
root /srv/http/public;
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
if (-d $request_filename) {
|
||||
rewrite [^/]$ $http_x_forwarded_proto://$http_host$uri/ redirect;
|
||||
}
|
||||
}
|
||||
|
||||
location /healthz {
|
||||
access_log off;
|
||||
add_header 'Content-Type' 'application/json';
|
||||
return 200 '{"status":"OK"}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
5
static/index.html
Normal file
5
static/index.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
Coming Eventually!
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user