Skip to content

Commit b93a657

Browse files
committed
part 2 or rearrange repo
1 parent c82af09 commit b93a657

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:latest
2+
3+
ENV XCADDY_VERSION=0.3.0 \
4+
GOLANG_VERSION=18.1 \
5+
APPPORT=:2011
6+
7+
COPY docker-files /
8+
9+
RUN set -x \
10+
&& apt-get -y update \
11+
&& apt-get install -y curl \
12+
&& mkdir build \
13+
&& cd build \
14+
&& curl -sSLO https://github.com/caddyserver/xcaddy/releases/download/v${XCADDY_VERSION}/xcaddy_${XCADDY_VERSION}_linux_amd64.tar.gz \
15+
&& curl -sSLO https://go.dev/dl/go1.${GOLANG_VERSION}.linux-amd64.tar.gz \
16+
&& rm -rf /usr/local/go \
17+
&& tar -C /usr/local -xzf go1.${GOLANG_VERSION}.linux-amd64.tar.gz \
18+
&& export PATH=$PATH:/usr/local/go/bin \
19+
&& tar xfvz xcaddy_${XCADDY_VERSION}_linux_amd64.tar.gz \
20+
&& ./xcaddy build --with github.com/kirsch33/realip \
21+
--with github.com/caddyserver/jsonc-adapter \
22+
--with github.com/git001/caddyv2-upload \
23+
&& pwd \
24+
&& mv caddy /usr/local/bin/ \
25+
&& cd .. \
26+
&& apt-get -y autoremove \
27+
&& apt-get -y autoclean \
28+
&& rm -rf build /usr/local/go /var/cache/apk/* \
29+
&& /usr/local/bin/caddy list-modules
30+
31+
WORKDIR /opt/webroot/
32+
33+
# CMD ["executable","param1","param2"] (exec form, this is the preferred form)
34+
CMD ["/usr/local/bin/caddy","run","-adapter","jsonc","-config","config/Caddyfile-upload.json"]

README.adoc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ will I write here the config only in JSON Syntax.
3131
<2> Maximal possible upload size
3232
<3> the response template which will be used for respose after upload
3333

34-
A full working example is in Caddyfile-upload.json
34+
A full working example is in
35+
`docker-files/opt/webroot/config/Caddyfile-upload.json`
3536

3637
# build
3738

@@ -44,10 +45,28 @@ xcaddy build --with github.com/kirsch33/realip \
4445

4546
# run
4647

48+
## cli
49+
4750
[source,shell]
4851
---
4952
APPPORT=:2011 ./caddy run \
5053
-adapter jsonc \
5154
-config Caddyfile-upload.json
55+
---
56+
57+
## docker
58+
59+
You can get this image from docker hub
5260

61+
The default listen port is defined with this variable
62+
63+
`APPPORT=:2011`
64+
65+
https://hub.docker.com/r/me2digital/caddyv2-upload
66+
67+
[source,shell]
5368
---
69+
podman run --rm docker.io/me2digital/caddyv2-upload:0.1
70+
# or
71+
docker run --rm docker.io/me2digital/caddyv2-upload:0.1
72+
---

docker-files/opt/webroot/config/Caddyfile-upload.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
{
3636
"handler": "templates"
3737
},
38+
{
39+
"handler": "headers",
40+
"response": {
41+
"set": {
42+
"Content-Type": ["text/plain; charset=utf-8"]
43+
}
44+
}
45+
},
3846
{
3947
"handler": "upload",
4048
"dest_dir": "tmp-upl",
@@ -56,6 +64,14 @@
5664
"logs": {
5765
"default": {
5866
"level": "DEBUG"
67+
},
68+
"myaccesslogger": {
69+
"writer": {
70+
"output": "stdout"
71+
},
72+
"encoder": {
73+
"format": "json"
74+
}
5975
}
6076
}
6177
}

docker-files/opt/webroot/data/.git-keep

Whitespace-only changes.

0 commit comments

Comments
 (0)