Compare commits

..

No commits in common. "master" and "0.1.0" have entirely different histories.

10 changed files with 147 additions and 100 deletions

View File

@ -1,13 +0,0 @@
kind: pipeline
name: default
workspace:
base: /go
path: src/deadbeef.codes/steven/docker-webdav-nginx
steps:
- name: docker build
image: plugins/docker
settings:
repo: registry.deadbeef.codes/docker-webdav-nginx

9
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"dependencyDashboard": true,
"dependencyDashboardTitle": "Renovate Dashboard",
"labels": ["renovatebot"]
}

94
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: CI/CD
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
schedule:
- cron: "0 5 * * 0"
workflow_dispatch:
env:
USER: loganmarchione
REPO: docker-webdav-nginx
jobs:
ubuntu_ci:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v3
- name: Set variables
run: |
VER=$(cat VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
push: false
context: .
file: Dockerfile
load: true
tags: |
${{ env.USER }}/${{ env.REPO }}:${{ env.VERSION }}
${{ env.USER }}/${{ env.REPO }}:latest
- name: Test image
run: |
docker images
docker run --name test-container --detach --env WEBDAV_USER=user --env WEBDAV_PASS=password1 --volume 'webdav:/var/www/webdav' ${USER}/${REPO}:${VERSION}
docker ps -a
- name: Container scan
uses: azure/container-scan@v0
with:
image-name: ${{ env.USER }}/${{ env.REPO }}:${{ env.VERSION }}
severity-threshold: CRITICAL
run-quality-checks: true
ubuntu_cd:
name: Deploy
needs: ubuntu_ci
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v3
- name: Set variables
run: |
VER=$(cat VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASS }}
logout: true
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
push: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
${{ env.USER }}/${{ env.REPO }}:${{ env.VERSION }}
${{ env.USER }}/${{ env.REPO }}:latest

View File

@ -1,14 +1,19 @@
FROM debian:12-slim
FROM ubuntu:jammy
# Originally
# LABEL maintainer="Logan Marchione <logan@loganmarchione.com>" \
LABEL maintainer="himself@stevenpolley.net"
ARG BUILD_DATE
LABEL \
maintainer="Logan Marchione <logan@loganmarchione.com>" \
org.opencontainers.image.authors="Logan Marchione <logan@loganmarchione.com>" \
org.opencontainers.image.title="docker-webdav-nginx" \
org.opencontainers.image.description="Runs a Nginx WebDav server in Docker" \
org.opencontainers.image.created=$BUILD_DATE
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
apache2-utils \
netcat-openbsd \
netcat \
nginx-extras && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p "/var/www/webdav/restricted" && \
@ -20,13 +25,11 @@ EXPOSE 80
VOLUME [ "/var/www/webdav" ]
COPY entrypoint.sh /
COPY VERSION /
COPY password.sh password.sh
COPY webdav.conf /etc/nginx/sites-enabled/webdav
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/password.sh"]
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,11 +1,12 @@
[![Build Status](https://drone.deadbeef.codes/api/badges/steven/docker-webdav-nginx/status.svg)](https://drone.deadbeef.codes/steven/docker-webdav-nginx)
# docker-webdav-nginx
[![CI/CD](https://github.com/loganmarchione/docker-webdav-nginx/actions/workflows/main.yml/badge.svg)](https://github.com/loganmarchione/docker-webdav-nginx/actions/workflows/main.yml)
[![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/loganmarchione/docker-webdav-nginx)](https://hub.docker.com/r/loganmarchione/docker-webdav-nginx)
Runs a Nginx WebDav server in Docker
- Source code: [GitHub](https://github.com/loganmarchione/docker-webdav-nginx)
- Docker container: [Docker Hub](https://hub.docker.com/r/loganmarchione/docker-webdav-nginx)
- Image base: [Debian](https://hub.docker.com/_/debian)
- Image base: [Ubuntu](https://hub.docker.com/_/ubuntu)
- Init system: N/A
- Application: [Nginx](https://nginx.org/)
- Architecture: `linux/amd64,linux/arm64,linux/arm/v7`
@ -29,11 +30,10 @@ Runs a Nginx WebDav server in Docker
- `X.X.X`: [Semantic version](https://semver.org/) (use if you want to stick on a specific version)
### Environment variables
| Variable | Required? | Definition | Example | Comments |
|----------------------------|--------------------|----------------------------------------------------------------------------------------------------------------|----------------------------|--------------------------------------------------------------|
| WEBDAV_USER | No | WebDav username | user | user AND pass need to be set for authentication to work |
| WEBDAV_PASS | No | WebDav password | password1 | user AND pass need to be set for authentication to work |
| NGINX_CLIENT_MAX_BODY_SIZE | No (default: 250M) | Nginx's [client_max_body_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) | 500M | Be sure to include the units. Set to `0` to disable. |
| Variable | Required? | Definition | Example | Comments |
|-------------|-----------|----------------------------------|----------------------------|--------------------------------------------------------------|
| WEBDAV_USER | No | WebDav username | user | user AND pass need to be set for authentication to work |
| WEBDAV_PASS | No | WebDav password | password1 | user AND pass need to be set for authentication to work |
### Ports
| Port on host | Port in container | Comments |
@ -51,12 +51,11 @@ Below is an example docker-compose.yml file.
version: '3'
services:
webdav:
container_name: docker-webdav-nginx
container_name: webdav
restart: unless-stopped
environment:
- WEBDAV_USER=user
- WEBDAV_PASS=password1
- NGINX_CLIENT_MAX_BODY_SIZE=500M
networks:
- webdav
ports:
@ -73,16 +72,4 @@ volumes:
driver: local
```
Below is an example of running locally (used to edit/test/debug).
```
# Build the Dockerfile
docker compose -f docker-compose-dev.yml up -d
# View logs
docker compose -f docker-compose-dev.yml logs -f
# Destroy when done
docker compose -f docker-compose-dev.yml down
```
## TODO

View File

@ -1 +1 @@
0.3.1
0.1.0

View File

@ -1,25 +0,0 @@
version: '3'
services:
webdav:
container_name: docker-webdav-nginx
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
environment:
- WEBDAV_USER=user
- WEBDAV_PASS=password1
- NGINX_CLIENT_MAX_BODY_SIZE=500M
networks:
- webdav
ports:
- '8888:80'
volumes:
- 'webdav:/var/www/webdav'
networks:
webdav:
volumes:
webdav:
driver: local

View File

@ -1,27 +0,0 @@
#!/bin/sh -e
printf "########################################\n"
printf "# Container starting up!\n"
printf "########################################\n"
# Check for WebDav user/pass
printf "# STATE: Checking for WebDav user/pass\n"
if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ]
then
printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n"
htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1
else
printf "# WARN: No WebDav user/pass were set, the "restricted" directory has no authentication on it!\n"
sed -i "s/.*auth_basic.*//g" /etc/nginx/sites-enabled/webdav
sed -i "s/.*auth_basic_user_file.*//g" /etc/nginx/sites-enabled/webdav
fi
# Check for client_max_body_size setting
if [ -n "$NGINX_CLIENT_MAX_BODY_SIZE" ]
then
printf "# STATE: Setting client_max_body_size to $NGINX_CLIENT_MAX_BODY_SIZE\n"
sed -i "s/client_max_body_size 250M;/client_max_body_size $NGINX_CLIENT_MAX_BODY_SIZE;/g" /etc/nginx/sites-enabled/webdav
fi
printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n"
exec "$@"

21
password.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh -e
printf "#####\n"
printf "# Container starting up!\n"
printf "#####\n"
# Check for WebDav user/pass
printf "# STATE: Checking for WebDav user/pass\n"
if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ]
then
printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n"
htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1
else
printf "# WARN: No WebDav user/pass were set, the 'restricted' diretory has no authentication on it!\n"
sed -i 's/.*auth_basic.*//g' /etc/nginx/sites-enabled/webdav
sed -i 's/.*auth_basic_user_file.*//g' /etc/nginx/sites-enabled/webdav
fi
printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n"
exec "$@"

View File

@ -5,8 +5,6 @@ server {
root /var/www/webdav;
autoindex on;
client_max_body_size 250M;
location /public {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;