generated from oci/template
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 16m30s
125 lines
No EOL
3.8 KiB
Docker
125 lines
No EOL
3.8 KiB
Docker
# FreeTAKServer Docker Container
|
|
# Based on the easy_install.sh script from FreeTAKTeam/FreeTAKHub-Installation
|
|
# Licensed under the Eclipse Public License 2.0 (EPL-2.0)
|
|
|
|
FROM ubuntu:22.04
|
|
|
|
# Set environment variables to prevent interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV NEEDRESTART_SUSPEND=1
|
|
ENV TZ=UTC
|
|
|
|
# Set default installation parameters
|
|
ENV INSTALL_TYPE=latest
|
|
ENV PY3_VER=3.11
|
|
ENV STABLE_FTS_VERSION=2.0.66
|
|
ENV LEGACY_FTS_VERSION=1.9.9.6
|
|
ENV FTS_VENV=/opt/fts.venv
|
|
ENV REPO=https://github.com/FreeTAKTeam/FreeTAKHub-Installation.git
|
|
ENV BRANCH=main
|
|
ENV CFG_RPATH=core/configuration
|
|
|
|
# Create application directory
|
|
WORKDIR /opt/freetak
|
|
|
|
# Update system and install base dependencies
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
software-properties-common \
|
|
curl \
|
|
wget \
|
|
git \
|
|
python3-pip \
|
|
python3-setuptools \
|
|
python${PY3_VER}-dev \
|
|
python${PY3_VER}-venv \
|
|
libpython${PY3_VER}-dev \
|
|
build-essential \
|
|
libssl-dev \
|
|
libffi-dev \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
libjpeg-dev \
|
|
libpng-dev \
|
|
zlib1g-dev \
|
|
sqlite3 \
|
|
libsqlite3-dev \
|
|
sudo \
|
|
openssh-client \
|
|
ca-certificates \
|
|
gnupg \
|
|
lsb-release && \
|
|
# Add Ansible PPA and install
|
|
add-apt-repository -y ppa:ansible/ansible && \
|
|
apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends ansible && \
|
|
# Clean up apt cache
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Get latest FTS version from PyPI
|
|
RUN LATEST_FTS_VERSION=$(curl -s https://pypi.org/pypi/FreeTAKServer/json | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") && \
|
|
echo "export LATEST_FTS_VERSION=${LATEST_FTS_VERSION}" >> /etc/environment
|
|
|
|
# Create Python virtual environment and install dependencies
|
|
RUN python${PY3_VER} -m venv ${FTS_VENV} && \
|
|
. ${FTS_VENV}/bin/activate && \
|
|
python3 -m pip install --upgrade pip && \
|
|
python3 -m pip install --force-reinstall jinja2 pyyaml psutil
|
|
|
|
# Clone FreeTAKHub-Installation repository
|
|
RUN git clone --branch ${BRANCH} ${REPO} /opt/FreeTAKHub-Installation
|
|
|
|
# Set working directory to the cloned repository
|
|
WORKDIR /opt/FreeTAKHub-Installation
|
|
|
|
# Create a non-root user for running the application
|
|
RUN useradd -m -u 1000 -s /bin/bash freetak && \
|
|
usermod -aG sudo freetak && \
|
|
echo "freetak ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
|
|
# Generate SSH key pair for the freetak user
|
|
RUN mkdir -p /home/freetak/.ssh && \
|
|
ssh-keygen -t rsa -f /home/freetak/.ssh/id_rsa -N "" && \
|
|
chown -R freetak:freetak /home/freetak/.ssh && \
|
|
chmod 700 /home/freetak/.ssh && \
|
|
chmod 600 /home/freetak/.ssh/id_rsa && \
|
|
chmod 644 /home/freetak/.ssh/id_rsa.pub
|
|
|
|
# Copy the virtual environment to be accessible by freetak user
|
|
RUN chown -R freetak:freetak ${FTS_VENV}
|
|
|
|
# Copy the scripts
|
|
COPY scripts/install_freetak.sh /opt/install_freetak.sh
|
|
COPY scripts/start_freetak.sh /opt/start_freetak.sh
|
|
COPY scripts/healthcheck.sh /opt/healthcheck.sh
|
|
COPY scripts/entrypoint.sh /opt/entrypoint.sh
|
|
|
|
# Make the scripts executable
|
|
RUN chmod +x /opt/install_freetak.sh /opt/start_freetak.sh /opt/healthcheck.sh /opt/entrypoint.sh
|
|
|
|
# Run the installation
|
|
RUN /opt/install_freetak.sh
|
|
|
|
# Set proper ownership
|
|
RUN chown -R freetak:freetak /opt/FreeTAKHub-Installation /opt/freetak /opt/*.sh
|
|
|
|
# Switch to freetak user
|
|
USER freetak
|
|
|
|
# Set the working directory
|
|
WORKDIR /opt/freetak
|
|
|
|
# Expose the default FreeTAKServer ports
|
|
# 8087 - Main server port
|
|
# 8080 - Web UI port
|
|
# 8443 - HTTPS port
|
|
# 19023 - FTS API port
|
|
EXPOSE 8087 8080 8443 19023
|
|
|
|
# Add healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD /opt/healthcheck.sh
|
|
|
|
# Default command - use the entrypoint script
|
|
CMD ["/opt/entrypoint.sh"] |