tacticalrmm/docker/containers/tactical/dockerfile

66 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-11-23 05:15:00 +00:00
# creates python virtual env
2023-04-07 20:30:24 +00:00
FROM python:3.11.3-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-23 05:15:00 +00:00
pip install --upgrade pip && \
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
2022-01-21 23:11:27 +00:00
# pulls community scripts from git repo
2023-04-07 20:30:24 +00:00
FROM python:3.11.3-slim AS GET_SCRIPTS_STAGE
2022-01-21 23:11:27 +00:00
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
git clone https://github.com/amidaware/community-scripts.git /community-scripts
2020-11-23 05:15:00 +00:00
# runtime image
2023-04-07 20:30:24 +00:00
FROM python:3.11.3-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
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
2022-01-21 23:11:27 +00:00
COPY --from=GET_SCRIPTS_STAGE /community-scripts ${TACTICAL_TMP_DIR}/community-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
2022-01-16 01:38:55 +00:00
EXPOSE 8080 4443 8383