fix: fix a "watch" bug due to docker limitation
This commit is contained in:
parent
3f78a39b40
commit
ac9451e5e9
9 changed files with 46 additions and 13 deletions
|
|
@ -57,7 +57,9 @@ RUN apt-get update && \
|
|||
find / -type d -path /proc -prune -o -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; && \
|
||||
find / -type d -path /proc -prune -o -type f -perm /g+s -ignore_readdir_race -exec chmod g-s {} \; && \
|
||||
mkdir -p /rpxy/bin &&\
|
||||
mkdir -p /rpxy/log
|
||||
mkdir -p /rpxy/log &&\
|
||||
mkdir -p /rpxy/cache &&\
|
||||
mkdir -p /rpxy/config
|
||||
|
||||
COPY --from=builder /tmp/target/release/rpxy /rpxy/bin/rpxy
|
||||
COPY ./docker/run.sh /rpxy
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ RUN apk add --no-cache ${RUNTIME_DEPS} && \
|
|||
find / -type d -path /proc -prune -o -type f -perm /u+s -exec chmod u-s {} \; && \
|
||||
find / -type d -path /proc -prune -o -type f -perm /g+s -exec chmod g-s {} \; && \
|
||||
mkdir -p /rpxy/bin &&\
|
||||
mkdir -p /rpxy/log
|
||||
mkdir -p /rpxy/log &&\
|
||||
mkdir -p /rpxy/cache &&\
|
||||
mkdir -p /rpxy/config
|
||||
|
||||
COPY --from=builder /tmp/target/release/rpxy /rpxy/bin/rpxy
|
||||
COPY ./docker/run.sh /rpxy
|
||||
|
|
|
|||
|
|
@ -28,7 +28,11 @@ services:
|
|||
tty: false
|
||||
privileged: true
|
||||
volumes:
|
||||
- ./log:/rpxy/log
|
||||
- ./log:/rpxy/log:rw
|
||||
- ./cache:/rpxy/cache:rw
|
||||
- ../example-certs/server.crt:/certs/server.crt:ro
|
||||
- ../example-certs/server.key:/certs/server.key:ro
|
||||
- ../config-example.toml:/etc/rpxy.toml:ro
|
||||
- ../config-example.toml:/etc/rpxy/rpxy.toml:ro
|
||||
# NOTE: To correctly enable "watch" in docker,
|
||||
# ** you should mount not a file but a dir mapped to /rpxy/config including "rpxy.toml" due to the limitation of docker **
|
||||
# e.g, - ./rpxy-config:/rpxy/config
|
||||
|
|
|
|||
|
|
@ -28,7 +28,11 @@ services:
|
|||
tty: false
|
||||
privileged: true
|
||||
volumes:
|
||||
- ./log:/rpxy/log
|
||||
- ./log:/rpxy/log:rw
|
||||
- ./cache:/rpxy/cache:rw
|
||||
- ../example-certs/server.crt:/certs/server.crt:ro
|
||||
- ../example-certs/server.key:/certs/server.key:ro
|
||||
- ../config-example.toml:/etc/rpxy.toml:ro
|
||||
# NOTE: To correctly enable "watch" in docker,
|
||||
# ** you should mount not a file but a dir mapped to /rpxy/config including "rpxy.toml" due to the limitation of docker **
|
||||
# e.g, - ./rpxy-config:/rpxy/config
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ USER=${HOST_USER:-rpxy}
|
|||
USER_ID=${HOST_UID:-900}
|
||||
GROUP_ID=${HOST_GID:-900}
|
||||
|
||||
CONFIG_FILE=/etc/rpxy.toml
|
||||
CONFIG_DIR=/rpxy/config
|
||||
CONFIG_FILE_IN_DIR=${CONFIG_FILENAME:-rpxy.toml}
|
||||
|
||||
#######################################
|
||||
# Setup logrotate
|
||||
function setup_logrotate () {
|
||||
|
|
@ -132,9 +136,23 @@ if [ $(id -u ${USER}) -ne ${USER_ID} -a $(id -g ${USER}) -ne ${GROUP_ID} ]; then
|
|||
fi
|
||||
|
||||
# Change permission according to the given user
|
||||
chown -R ${USER_ID}:${USER_ID} /rpxy
|
||||
# except for the config dir that possibly get mounted with read-only
|
||||
find /rpxy -path ${CONFIG_DIR} -prune -o -exec chown ${USER_ID}:${USER_ID} {} +
|
||||
|
||||
# Check the config file existence
|
||||
if [[ ! -f ${CONFIG_FILE} ]]; then
|
||||
if [[ ! -f ${CONFIG_DIR}/${CONFIG_FILE_IN_DIR} ]]; then
|
||||
echo "No config file is given. Mount a config dir or file."
|
||||
exit 1
|
||||
fi
|
||||
echo "rpxy: config file: ${CONFIG_DIR}/${CONFIG_FILE_IN_DIR}"
|
||||
ln -s ${CONFIG_DIR}/${CONFIG_FILE_IN_DIR} ${CONFIG_FILE}
|
||||
else
|
||||
echo "rpxy: config file: ${CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Run rpxy
|
||||
cd /rpxy
|
||||
echo "rpxy: Start with user: ${USER} (${USER_ID}:${GROUP_ID})"
|
||||
if "${LOGGING}"; then
|
||||
echo "rpxy: Start with writing log file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue