InvenTree/docker/Dockerfile

57 lines
2.0 KiB
Docker
Raw Normal View History

2021-03-31 11:45:42 +00:00
FROM python:alpine as production
# Configuration params
ARG INVENTREE_REPO="https://github.com/inventree/InvenTree.git"
ARG INVENTREE_VERSION="master"
ARG INVENTREE_HOME="/home/inventree"
ENV PYTHONUNBUFFERED 1
# InvenTree paths
ENV INVENTREE_SRC_DIR="$INVENTREE_HOME/src"
ENV INVENTREE_STATIC_ROOT="$INVENTREE_HOME/static"
ENV INVENTREE_MEDIA_ROOT="$INVENTREE_HOME/media"
ENV INVENTREE_LOG_DIR="$INVENTREE_HOME/log"
ENV INVENTREE_BACKUP_DIR="$INVENTREE_HOME/backup"
ENV INVENTREE_VENV="$INVENTREE_HOME/env"
RUN echo "Installing InvenTree '${INVENTREE_VERSION}' from ${INVENTREE_REPO}"
# Create user account
2021-03-31 11:54:17 +00:00
RUN addgroup -S inventreegroup && adduser -S inventree -G inventreegroup
2021-03-31 11:45:42 +00:00
WORKDIR /home/inventree
# Install required system packages
2021-03-31 12:20:32 +00:00
RUN apk add --no-cache git make bash \
gcc libgcc g++ libstdc++ \
libjpeg-turbo libjpeg-turbo-dev jpeg jpeg-dev \
libffi libffi-dev \
2021-03-31 12:22:17 +00:00
zlib zlib-dev
2021-03-31 12:20:32 +00:00
RUN apk add --no-cache cairo cairo-dev pango pango-dev
RUN apk add --no-cache fontconfig ttf-droid ttf-liberation ttf-dejavu ttf-opensans ttf-ubuntu-font-family font-croscore font-noto
RUN apk add --no-cache python3
2021-03-31 12:03:13 +00:00
RUN apk add --no-cache postgresql-contrib postgresql-dev libpq
2021-03-31 12:06:54 +00:00
RUN apk add --no-cache mariadb-connector-c mariadb-dev
2021-03-31 11:45:42 +00:00
2021-03-31 12:20:32 +00:00
# Clone source code
RUN git clone --branch $INVENTREE_VERSION --depth 1 ${INVENTREE_REPO} ${INVENTREE_SRC_DIR}
2021-03-31 11:45:42 +00:00
# Install required PIP packages
RUN python -m venv $INVENTREE_VENV && pip install --upgrade pip setuptools wheel
RUN python -m venv $INVENTREE_VENV && pip install --no-cache-dir -U invoke
RUN python -m venv $INVENTREE_VENV && pip install --no-cache-dir -U psycopg2 mysqlclient pgcli mariadb
# Install InvenTree packages
RUN python -m venv $INVENTREE_VENV && pip install --no-cache-dir -U -r $INVENTREE_SRC_DIR/requirements.txt
# Install supervisor
2021-03-31 12:27:01 +00:00
RUN apk add --no-cache supervisor
2021-03-31 11:45:42 +00:00
2021-03-31 11:47:41 +00:00
# Create required directories
RUN mkdir /home/inventree/media /home/inventree/static /home/inventree/log /home/inventree/backup
2021-03-31 11:45:42 +00:00
# Copy supervisor file
COPY deploy/inventree.conf /etc/supervisor/conf.d/inventree.conf
CMD ["/usr/bin/supervisord"]