Compare commits

...

4 Commits

Author SHA1 Message Date
Tom Alexander
a78b4eb7c4 Modernize the makefile for the docker image.
All checks were successful
build-homepage Build build-homepage has succeeded
semver Build semver has succeeded
2023-12-23 06:27:37 -05:00
Tom Alexander
9ebcf96ed2 Change default mime type inside .well-known to be plain text.
All checks were successful
semver Build semver has succeeded
build-homepage Build build-homepage has succeeded
2023-09-23 12:36:58 -04:00
Tom Alexander
846da7bcf9 Move well-known to not be hidden. Nginx will handle rewriting the path.
All checks were successful
semver Build semver has succeeded
build-homepage Build build-homepage has succeeded
2023-09-23 12:29:31 -04:00
Tom Alexander
ae7240b2f4 Render my public pgp key in the browser instead of downloading it.
All checks were successful
semver Build semver has succeeded
build-homepage Build build-homepage has succeeded
2023-09-21 23:18:37 -04:00
3 changed files with 41 additions and 15 deletions

View File

@@ -1,35 +1,51 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
OS:=$(shell uname -s)
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
IMAGE_NAME:=homepage IMAGE_NAME:=homepage
# REMOTE_REPO:=harbor.fizz.buzz/private # REMOTE_REPO:=harbor.fizz.buzz/private
TARGET :=
.PHONY: all .PHONY: help
all: build push help:
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
.PHONY: build .PHONY: build
build: build: ## Build the docker image.
docker build -t $(IMAGE_NAME) -f Dockerfile ../ > docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile ../../
.PHONY: push .PHONY: push
push: push: ## Push the docker image to a remote repository.
ifdef REMOTE_REPO ifdef REMOTE_REPO
docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME) > docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME)
docker push $(REMOTE_REPO)/$(IMAGE_NAME) > docker push $(REMOTE_REPO)/$(IMAGE_NAME)
else else
@echo "REMOTE_REPO not defined, not pushing to a remote repo." > @echo "REMOTE_REPO not defined, not pushing to a remote repo."
endif endif
.PHONY: clean .PHONY: clean
clean: clean:
docker rmi $(IMAGE_NAME) > docker rmi $(IMAGE_NAME)
ifdef REMOTE_REPO ifdef REMOTE_REPO
docker rmi $(REMOTE_REPO)/$(IMAGE_NAME) > docker rmi $(REMOTE_REPO)/$(IMAGE_NAME)
else else
@echo "REMOTE_REPO not defined, not removing from remote repo." > @echo "REMOTE_REPO not defined, not removing from remote repo."
endif endif
.PHONY: run .PHONY: run
run: run: ## Launch the docker image
docker run --rm -i -t -p "8080:8080" $(IMAGE_NAME) > docker run --rm -i -t -p "8080:8080" $(IMAGE_NAME)
.PHONY: shell .PHONY: shell
shell: shell: ## Launch an interactive shell inside the docker image.
docker run --rm -i -t -p "8080:8080" --entrypoint /bin/bash $(IMAGE_NAME) shell: build
> docker run --rm -i -t -p "8080:8080" --entrypoint /bin/bash --mount type=tmpfs,destination=/tmp $(IMAGE_NAME)

View File

@@ -14,6 +14,11 @@ events {
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
types {
text/plain asc;
}
server_tokens off; server_tokens off;
client_max_body_size 1m; client_max_body_size 1m;
sendfile on; sendfile on;
@@ -38,6 +43,11 @@ http {
return 200 '{"status":"OK"}'; return 200 '{"status":"OK"}';
} }
location /.well-known/ {
alias /srv/http/public/well-known/;
default_type text/plain;
}
location /.well-known/matrix/server { location /.well-known/matrix/server {
default_type application/json; default_type application/json;
add_header "Access-Control-Allow-Origin" *; add_header "Access-Control-Allow-Origin" *;