mirror of
https://github.com/FoxxMD/context-mod.git
synced 2026-01-15 00:18:06 -05:00
* Improve errors when checking if file is readable or directory/file is writable * Implement custom winston-typeorm logging mappings so migrations are output at INFO level * Add typeorm logging options to database config and default to displaying error, warning, and migrations * Ensure directory is writeable before using log rotation transport for winston * Move init logger into index so its always available * Simplify printing stack for SimpleError when it's a cause * Better handling for access permissions when reading operator config file * Add hint to errors relating to permissions access if app detects its running in docker
53 lines
1.1 KiB
Docker
53 lines
1.1 KiB
Docker
FROM node:16-alpine3.14 as base
|
|
|
|
ENV TZ=Etc/GMT
|
|
|
|
# vips required to run sharp library for image comparison
|
|
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/repositories \
|
|
&& apk --no-cache add vips
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
ARG data_dir=/config
|
|
RUN mkdir -p $data_dir && \
|
|
chown -R node:node $data_dir && \
|
|
chmod 755 $data_dir
|
|
VOLUME $data_dir
|
|
ENV DATA_DIR=$data_dir
|
|
|
|
# https://github.com/nodejs/docker-node/issues/740
|
|
WORKDIR /home/node
|
|
|
|
FROM base as build
|
|
|
|
COPY --chown=node:node package*.json ./
|
|
COPY --chown=node:node tsconfig.json .
|
|
|
|
RUN npm install
|
|
|
|
ADD --chown=node:node . /home/node
|
|
|
|
RUN npm run build && rm -rf node_modules
|
|
|
|
FROM base as app
|
|
|
|
COPY --from=build --chown=node:node /home/node /home/node
|
|
|
|
RUN npm install --production
|
|
|
|
ENV NPM_CONFIG_LOGLEVEL debug
|
|
|
|
# can set database to use more performant better-sqlite3 since we control everything
|
|
ENV DB_DRIVER=better-sqlite3
|
|
|
|
ARG webPort=8085
|
|
ENV PORT=$webPort
|
|
EXPOSE $PORT
|
|
|
|
# convenience variable for more helpful error messages
|
|
ENV IS_DOCKER=true
|
|
|
|
USER node
|
|
|
|
CMD [ "node", "src/index.js", "run" ]
|