refactor(docker): Improve data directory flexibility and build order

* Create data directory if not /config
* Copy s6 files in base to make incremental builds faster
This commit is contained in:
FoxxMD
2022-04-07 15:23:14 -04:00
parent 6764995dfe
commit b670ad73c4
2 changed files with 10 additions and 11 deletions

View File

@@ -75,7 +75,7 @@ RUN apk add --no-cache \
&& apk del .build-deps \
# smoke tests
&& node --version \
&& npm --version \
&& npm --version
#
# end of docker node stuff
#
@@ -87,12 +87,11 @@ RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/reposi
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG data_dir=/config
#RUN mkdir -p $data_dir && \
# chown -R abc:abc $data_dir && \
# chmod 755 $data_dir
VOLUME $data_dir
ENV DATA_DIR=$data_dir
COPY docker/root/ /
WORKDIR /app
FROM base as build
@@ -110,7 +109,9 @@ FROM base as app
COPY --from=build --chown=abc:abc /app /app
RUN npm install --production && npm cache clean --force
RUN npm install --production \
&& npm cache clean --force \
&& chown abc:abc node_modules
ENV NPM_CONFIG_LOGLEVEL debug
@@ -124,5 +125,3 @@ EXPOSE $PORT
# convenience variable for more helpful error messages
ENV IS_DOCKER=true
COPY docker/root/ /

View File

@@ -3,10 +3,10 @@
# used https://github.com/linuxserver/docker-plex as a template
# make data folder if not /config
#if [ ! -d "${DATA_DIR}" ]; then \
#mkdir -p "${DATA_DIR}"
#chown -R abc:abc /config
#fi
if [ ! -d "${DATA_DIR}" ]; then \
mkdir -p "${DATA_DIR}"
chown -R abc:abc /config
fi
# permissions
chown abc:abc \