Modify: settings - add DATA_DIR logs_collector storage_info use DATA_DIR as storage root

This commit is contained in:
2023-09-11 13:53:03 +09:00
parent 5893920d69
commit 57a758f93e
8 changed files with 112 additions and 24 deletions

View File

@@ -22,6 +22,7 @@ ENV PYTHONUNBUFFERED 1
# default build args
ARG VERSION=0.1.0 \
APP_DIR=/app \
DATA_DIR=/app/data \
SRC_DIR=./logs_collector \
SCRIPTS_DIR=./scripts \
WEB_PORT=8000 \
@@ -34,17 +35,20 @@ ARG VERSION=0.1.0 \
COPY --from=base /usr/local/lib/python3.10/site-packages/ /usr/local/lib/python3.10/site-packages/
COPY --from=base /usr/local/bin/ /usr/local/bin/
# add curl and createa user to avoid running container as root
# add curl and createa user to avoid running container as root &&
# create storage dir
RUN apk add --no-cache --upgrade curl && \
addgroup --system ${USER_GROUP} --gid ${APP_GID} && \
adduser --system --uid ${APP_UID} --ingroup ${USER_GROUP} ${USER_NAME}
adduser --system --uid ${APP_UID} --ingroup ${USER_GROUP} ${USER_NAME} && \
mkdir -p ${APP_DIR}/data && \
chown -R ${USER_NAME}:${USER_GROUP} ${DATA_DIR}
# switch to user
USER ${USER_NAME}
# copy src and entrypoint.sh to app dir
COPY --chown=${USER_NAME}:${USER_GROUP} ${SRC_DIR} ${APP_DIR}
COPY --chown=${USER_NAME}:${USER_GROUP} ${SCRIPTS_DIR}/entrypoint.sh ${APP_DIR}/
COPY --chown=${USER_NAME}:${USER_GROUP} ${SCRIPTS_DIR}/entrypoint.sh ${APP_DIR}
# set workdir
WORKDIR ${APP_DIR}