webdav image

This commit is contained in:
w-mj 2023-03-31 22:07:03 +08:00
parent 4e9d9b9cb0
commit f22294056e
No known key found for this signature in database
GPG Key ID: 3A2CB5BE2F835897
4 changed files with 89 additions and 0 deletions

3
webdav/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM ugeek/webdav:amd64
COPY entrypoint.sh /

7
webdav/Makefile Normal file
View File

@ -0,0 +1,7 @@
TAG = docker.educg.net/cg/webdav:v1.0
build:
docker build -t $(TAG) .
push:
docker push $(TAG)

11
webdav/entrypoint.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
if [ -n "$USERNAME" ] && [ -n "$PASSWORD" ]
then
htpasswd -bc /etc/nginx/htpasswd $USERNAME $PASSWORD
echo Done.
else
echo Using no auth.
sed -i 's%auth_basic "Restricted";% %g' /etc/nginx/conf.d/default.conf
sed -i 's%auth_basic_user_file htpasswd;% %g' /etc/nginx/conf.d/default.conf
fi

68
webdav/webdav.yaml Normal file
View File

@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cg-webdav
labels:
app: cg-webdav
spec:
replicas: 1
selector:
matchLabels:
app: cg-webdav
template:
metadata:
labels:
app: cg-webdav
spec:
containers:
- name: cg-webdav-container
# image: bytemark/webdav:2.4
image: docker.educg.net/cg/webdav:v1.0
# command: ["/bin/bash"]
# args: ["-c", "sleep 365d"]
ports:
- containerPort: 80
env:
- name: TZ
value: Asia/Shanghai
volumeMounts:
- name: webdav-nfs
mountPath: /media
# mountPath: /var/lib/dav
volumes:
- name: webdav-nfs
nfs:
server: 192.168.252.250
path: /mnt/CGdata/ms
---
apiVersion: v1
kind: Service
metadata:
name: cg-webdav-svc
labels:
name: cg-webdav-svc
spec:
ports:
- port: 80
targetPort: 80
selector:
app: cg-webdav
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: webdav-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /files(/|$)(.*)
pathType: Prefix
backend:
service:
name: cg-webdav-svc
port:
number: 80