2020-11-23 05:15:00 +00:00
|
|
|
# creates python virtual env
|
2021-11-19 06:58:18 +00:00
|
|
|
FROM python:3.9.9-slim AS CREATE_VENV_STAGE
|
2020-11-24 14:33:34 +00:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
2020-11-14 21:54:29 +00:00
|
|
|
|
2020-11-23 05:15:00 +00:00
|
|
|
# # set env variables
|
|
|
|
ENV VIRTUAL_ENV /opt/venv
|
|
|
|
ENV TACTICAL_DIR /opt/tactical
|
|
|
|
ENV TACTICAL_TMP_DIR /tmp/tactical
|
|
|
|
RUN python3 -m venv $VIRTUAL_ENV
|
|
|
|
ENV PATH "${VIRTUAL_ENV}/bin:$PATH"
|
|
|
|
|
2020-11-24 14:33:34 +00:00
|
|
|
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
|
|
|
|
2020-11-23 05:15:00 +00:00
|
|
|
COPY api/tacticalrmm/requirements.txt ${TACTICAL_TMP_DIR}/api/requirements.txt
|
|
|
|
|
2020-11-24 14:33:34 +00:00
|
|
|
RUN apt-get update && \
|
2021-03-22 22:12:57 +00:00
|
|
|
apt-get install -y --no-install-recommends gcc libc6-dev && \
|
2020-11-24 14:33:34 +00:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
2020-11-23 05:15:00 +00:00
|
|
|
pip install --upgrade pip && \
|
2021-09-06 03:49:10 +00:00
|
|
|
pip install --no-cache-dir setuptools wheel && \
|
2020-11-23 05:15:00 +00:00
|
|
|
pip install --no-cache-dir -r ${TACTICAL_TMP_DIR}/api/requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
# runtime image
|
2021-11-19 06:58:18 +00:00
|
|
|
FROM python:3.9.9-slim
|
2020-11-14 21:54:29 +00:00
|
|
|
|
2020-11-23 05:15:00 +00:00
|
|
|
# set env variables
|
|
|
|
ENV VIRTUAL_ENV /opt/venv
|
2020-11-16 19:28:10 +00:00
|
|
|
ENV TACTICAL_DIR /opt/tactical
|
2020-11-19 03:42:45 +00:00
|
|
|
ENV TACTICAL_TMP_DIR /tmp/tactical
|
2020-11-14 21:54:29 +00:00
|
|
|
ENV TACTICAL_READY_FILE ${TACTICAL_DIR}/tmp/tactical.ready
|
|
|
|
ENV TACTICAL_USER tactical
|
2021-03-30 20:52:03 +00:00
|
|
|
ENV PATH "${VIRTUAL_ENV}/bin:$PATH"
|
2020-11-14 21:54:29 +00:00
|
|
|
|
2020-11-18 03:55:13 +00:00
|
|
|
# copy files from repo
|
2020-11-19 03:42:45 +00:00
|
|
|
COPY api/tacticalrmm ${TACTICAL_TMP_DIR}/api
|
|
|
|
COPY scripts ${TACTICAL_TMP_DIR}/scripts
|
2020-11-23 05:15:00 +00:00
|
|
|
|
|
|
|
# copy go install from build stage
|
|
|
|
COPY --from=CREATE_VENV_STAGE ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
2020-11-16 19:28:10 +00:00
|
|
|
|
2020-11-18 03:55:13 +00:00
|
|
|
# install deps
|
2020-11-24 14:33:34 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get upgrade -y && \
|
2021-03-30 21:11:06 +00:00
|
|
|
apt-get install -y --no-install-recommends rsync && \
|
2020-11-24 14:33:34 +00:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
groupadd -g 1000 "${TACTICAL_USER}" && \
|
|
|
|
useradd -M -d "${TACTICAL_DIR}" -s /bin/bash -u 1000 -g 1000 "${TACTICAL_USER}"
|
|
|
|
|
|
|
|
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
2020-11-23 05:15:00 +00:00
|
|
|
|
2020-11-14 21:54:29 +00:00
|
|
|
# docker init
|
2020-11-16 19:28:10 +00:00
|
|
|
COPY docker/containers/tactical/entrypoint.sh /
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
2020-11-14 21:54:29 +00:00
|
|
|
|
2020-11-16 19:28:10 +00:00
|
|
|
WORKDIR ${TACTICAL_DIR}/api
|
2020-11-20 00:03:44 +00:00
|
|
|
|
2021-04-03 21:50:18 +00:00
|
|
|
EXPOSE 80 443 8383
|