mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add configuration options for the Dockerfile
This commit is contained in:
parent
76ab38a06b
commit
08a1a6cf43
@ -4,26 +4,43 @@ FROM python:alpine as production
|
|||||||
ARG INVENTREE_REPO="https://github.com/inventree/InvenTree.git"
|
ARG INVENTREE_REPO="https://github.com/inventree/InvenTree.git"
|
||||||
ARG INVENTREE_VERSION="master"
|
ARG INVENTREE_VERSION="master"
|
||||||
ARG INVENTREE_HOME="/home/inventree"
|
ARG INVENTREE_HOME="/home/inventree"
|
||||||
|
ARG INVENTREE_PORT="80"
|
||||||
|
|
||||||
|
# Database configuration options
|
||||||
|
ARG INVENTREE_DB_ENGINE="sqlite"
|
||||||
|
ARG INVENTREE_DB_NAME="inventree_db.sqlite3"
|
||||||
|
ARG INVENTREE_DB_HOST="127.0.0.1"
|
||||||
|
ARG INVENTREE_DB_PORT=""
|
||||||
|
ARG INVENTREE_DB_USER=""
|
||||||
|
ARG INVENTREE_DB_PASSWORD=""
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
# InvenTree paths
|
# InvenTree paths
|
||||||
ENV INVENTREE_SRC_DIR="$INVENTREE_HOME/src"
|
ENV INVENTREE_SRC_DIR="${INVENTREE_HOME}/src"
|
||||||
ENV INVENTREE_STATIC_ROOT="$INVENTREE_HOME/static"
|
ENV INVENTREE_STATIC_ROOT="${INVENTREE_HOME}/static"
|
||||||
ENV INVENTREE_MEDIA_ROOT="$INVENTREE_HOME/media"
|
ENV INVENTREE_MEDIA_ROOT="${INVENTREE_HOME}/media"
|
||||||
ENV INVENTREE_LOG_DIR="$INVENTREE_HOME/log"
|
ENV INVENTREE_LOG_DIR="${INVENTREE_HOME}/log"
|
||||||
ENV INVENTREE_BACKUP_DIR="$INVENTREE_HOME/backup"
|
ENV INVENTREE_BACKUP_DIR="${INVENTREE_HOME}/backup"
|
||||||
ENV INVENTREE_VENV="$INVENTREE_HOME/env"
|
ENV INVENTREE_VENV="${INVENTREE_HOME}/env"
|
||||||
|
|
||||||
|
# Pass DB configuration through as environment variables
|
||||||
|
ENV INVENTREE_DB_ENGINE="${INVENTREE_DB_ENGINE}"
|
||||||
|
ENV INVENTREE_DB_NAME="${INVENTREE_DB_NAME}"
|
||||||
|
ENV INVENTREE_DB_HOST="${INVENTREE_DB_HOST}"
|
||||||
|
ENV INVENTREE_DB_PORT="${INVENTREE_DB_PORT}"
|
||||||
|
ENV INVENTREE_DB_USER="${INVENTREE_DB_USER}"
|
||||||
|
ENV INVENTREE_DB_PASSWORD="${INVENTREE_DB_PASSWORD}"
|
||||||
|
|
||||||
LABEL org.label-schema.schema-version="1.0" \
|
LABEL org.label-schema.schema-version="1.0" \
|
||||||
org.label-schema.build-date=$DATE \
|
org.label-schema.build-date=${DATE} \
|
||||||
org.label-schema.vendor="inventree" \
|
org.label-schema.vendor="inventree" \
|
||||||
org.label-schema.name="inventree/inventree" \
|
org.label-schema.name="inventree/inventree" \
|
||||||
org.label-schema.url="https://hub.docker.com/r/inventree/inventree-docker" \
|
org.label-schema.url="https://hub.docker.com/r/inventree/inventree-docker" \
|
||||||
org.label-schema.version=$INVENTREE_VERSION \
|
org.label-schema.version=${INVENTREE_VERSION} \
|
||||||
org.label-schema.vcs-url=$INVENTREE_REPO \
|
org.label-schema.vcs-url=${INVENTREE_REPO} \
|
||||||
org.label-schema.vcs-branch=$BRANCH \
|
org.label-schema.vcs-branch=${BRANCH} \
|
||||||
org.label-schema.vcs-ref=$COMMIT
|
org.label-schema.vcs-ref=${COMMIT}
|
||||||
|
|
||||||
RUN echo "Installing InvenTree '${INVENTREE_VERSION}' from ${INVENTREE_REPO}"
|
RUN echo "Installing InvenTree '${INVENTREE_VERSION}' from ${INVENTREE_REPO}"
|
||||||
|
|
||||||
@ -44,15 +61,15 @@ RUN apk add --no-cache postgresql-contrib postgresql-dev libpq
|
|||||||
RUN apk add --no-cache mariadb-connector-c mariadb-dev
|
RUN apk add --no-cache mariadb-connector-c mariadb-dev
|
||||||
|
|
||||||
# Clone source code
|
# Clone source code
|
||||||
RUN git clone --branch $INVENTREE_VERSION --depth 1 ${INVENTREE_REPO} ${INVENTREE_SRC_DIR}
|
RUN git clone --branch ${INVENTREE_VERSION} --depth 1 ${INVENTREE_REPO} ${INVENTREE_SRC_DIR}
|
||||||
|
|
||||||
# Install required PIP packages
|
# Install required PIP packages
|
||||||
RUN python -m venv $INVENTREE_VENV && pip install --upgrade pip setuptools wheel
|
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 invoke
|
||||||
RUN python -m venv $INVENTREE_VENV && pip install --no-cache-dir -U psycopg2 mysqlclient pgcli mariadb
|
RUN python -m venv ${INVENTREE_VENV} && pip install --no-cache-dir -U psycopg2 mysqlclient pgcli mariadb
|
||||||
|
|
||||||
# Install InvenTree packages
|
# Install InvenTree packages
|
||||||
RUN python -m venv $INVENTREE_VENV && pip install --no-cache-dir -U -r $INVENTREE_SRC_DIR/requirements.txt
|
RUN python -m venv ${INVENTREE_VENV} && pip install --no-cache-dir -U -r ${INVENTREE_SRC_DIR}/requirements.txt
|
||||||
|
|
||||||
# Install supervisor
|
# Install supervisor
|
||||||
RUN apk add --no-cache supervisor
|
RUN apk add --no-cache supervisor
|
||||||
@ -61,6 +78,6 @@ RUN apk add --no-cache supervisor
|
|||||||
RUN mkdir /home/inventree/media /home/inventree/static /home/inventree/log /home/inventree/backup
|
RUN mkdir /home/inventree/media /home/inventree/static /home/inventree/log /home/inventree/backup
|
||||||
|
|
||||||
# Copy supervisor file
|
# Copy supervisor file
|
||||||
COPY deploy/inventree.conf /etc/supervisor/conf.d/inventree.conf
|
COPY docker/inventree.conf /etc/supervisor/conf.d/inventree.conf
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
|
Loading…
Reference in New Issue
Block a user