Skip to content

Commit 5dedc4a

Browse files
committed
deploy: better docker deploy
1 parent 84d4eae commit 5dedc4a

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ RUN if [ "$BUILD_ENV" = "rex" ]; then echo "Change depends" \
1717
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
1818
; fi
1919

20-
COPY docker /app
2120
COPY requirements.d /app/requirements.d
21+
COPY entrypoint.sh /app/entrypoint.sh
2222

2323
RUN \
2424
# install python build depends ---
@@ -35,16 +35,15 @@ RUN \
3535
# LDAP client's depends ---
3636
&& apk add --no-cache libldap libsasl krb5-libs \
3737
# create non-root user ---
38-
&& apk add --no-cache shadow su-exec \
39-
&& addgroup -S -g $GID runner \
40-
&& adduser -S -D -G runner -u $UID -s /bin/sh runner \
38+
&& apk add --no-cache su-exec \
4139
# support timezone ---
4240
&& apk add --no-cache tzdata \
4341
# fix libexpat bug:
4442
# out of memory: line 1, column 0
4543
# https://bugs.launchpad.net/ubuntu/+source/python-xmltodict/+bug/1961800
4644
&& apk add 'expat>2.4.7' \
4745
# prepare ---
46+
&& chmod +x /app/entrypoint.sh \
4847
&& mkdir /data
4948

5049
COPY asgi_webdav /app/asgi_webdav
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
#!/bin/sh
22

3-
## set non-root user
4-
usermod -o -u "$UID" runner
5-
groupmod -o -g "$GID" runner
6-
73
echo "
84
------------------------
9-
User uid: $(id -u runner)
10-
User gid: $(id -g runner)
5+
App user's UID:GID
6+
$UID:$GID
117
------------------------
128
"
139

1410
echo "prepare..."
15-
chown -R runner:runner /data
11+
chown -R $UID:$GID /data
1612

1713
echo "server starting..."
18-
exec su-exec runner \
14+
exec su-exec $UID:$GID \
1915
python -m asgi_webdav \
2016
--host "$WEBDAV_HOST" \
2117
--port "$WEBDAV_PORT" \
2218
--config "$WEBDAV_CONFIGFILE" \
2319
--logging-no-display-datetime \
24-
--logging-no-use-colors
20+
--logging-no-use-colors

0 commit comments

Comments
 (0)