#--------------------------------------------------------------------------#
# Copyright (C) 2022 by Tibit Communications, Inc.                         #
# All rights reserved.                                                     #
#                                                                          #
#    _______ ____  _ ______                                                #
#   /_  __(_) __ )(_)_  __/                                                #
#    / / / / __  / / / /                                                   #
#   / / / / /_/ / / / /                                                    #
#  /_/ /_/_____/_/ /_/                                                     #
#                                                                          #
#  Distributed as Tibit-Customer confidential.                             #
#                                                                          #
#--------------------------------------------------------------------------#
FROM ubuntu:${UBUNTU_VERSION}

# Prepare the base image
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install systemd -y

# Create Temporary workspace for installation
RUN mkdir -p /tmp
WORKDIR /tmp

# Transfer package,scripts, and certificate config to temp workspace
COPY mongodb_start.sh /tmp/
COPY mongodb_install.sh /tmp/
COPY mongodb_uninstall.sh /tmp/
COPY legacy_uninstall.py /tmp/
COPY tibit_ponmgr_selfsigned_cert_req.conf /tmp/
COPY ${DEB_PKG_NAME} /tmp/

# Install debian package
RUN apt-get install ./${DEB_PKG_NAME} -y

# Run Apache2
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
