Add docker file and example content
This commit is contained in:
parent
b639e73d35
commit
2e8b87103f
6 changed files with 32 additions and 2 deletions
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM debian:10 AS build-stage
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get -y install openssl
|
||||||
|
RUN mkdir -p /app/certs
|
||||||
|
COPY openssl.conf .
|
||||||
|
RUN openssl req \
|
||||||
|
-x509 \
|
||||||
|
-newkey rsa:4096 \
|
||||||
|
-sha256 \
|
||||||
|
-days 3560 \
|
||||||
|
-nodes \
|
||||||
|
-keyout /app/certs/cert.key \
|
||||||
|
-out /app/certs/cert.pem \
|
||||||
|
-subj "/C=SE/ST=W/L=Borlange/O=Skunkworks/CN=gmnd.local" \
|
||||||
|
-extensions san \
|
||||||
|
-config openssl.conf
|
||||||
|
FROM python:3 AS deploy-stage
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./gmnd/__init__.py .
|
||||||
|
COPY ./content content
|
||||||
|
COPY --from=build-stage /app/certs certs
|
||||||
|
EXPOSE 1965
|
||||||
|
CMD ["python", "__init__.py"]
|
3
content/index.gmi
Normal file
3
content/index.gmi
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Headin
|
||||||
|
|
||||||
|
=> test/
|
0
content/test/file.gmi
Normal file
0
content/test/file.gmi
Normal file
0
content/test/file.txt
Normal file
0
content/test/file.txt
Normal file
|
@ -72,7 +72,7 @@ class gMNd:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def get_dir_list(self,directory):
|
def get_dir_list(self,directory):
|
||||||
contents = b"Contents:\r\n"
|
contents = b"#Contents:\r\n"
|
||||||
dirs = []
|
dirs = []
|
||||||
files = []
|
files = []
|
||||||
for mfile in os.listdir(self.base_path + directory):
|
for mfile in os.listdir(self.base_path + directory):
|
||||||
|
@ -105,5 +105,5 @@ def get_header(status='20', meta = b""):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
server = gMNd({'allow_dir_list': True})
|
server = gMNd({'allow_dir_list': True, 'logg_level': logging.DEBUG, 'listen_addr': '0.0.0.0'})
|
||||||
server.run()
|
server.run()
|
4
openssl.conf
Normal file
4
openssl.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[req]
|
||||||
|
distinguished_name=req
|
||||||
|
[san]
|
||||||
|
subjectAltName=DNS:localhost,DNS:gmnd.local
|
Loading…
Add table
Reference in a new issue