Files
cosmoserver/files/docker/Dockerfile

60 lines
1.7 KiB
Docker

# Base image
FROM php:8.1-apache
# Install system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
# Services
redis-server nginx \
# Python
python3 python3-venv python3-pip \
# Process supervisor
supervisor \
# Others
net-tools curl \
# Clean up
&& rm -rf /var/lib/apt/lists/*
# Install Node.js LTS 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get update && apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# copy the config file
COPY cosmostat_settings.yaml /app/cosmostat_settings.yaml
# Node on 3000
WORKDIR /usr/src/app
COPY web/node_server/ .
#COPY cosmostat_settings.yaml /usr/src/app/cosmostat_settings.yaml
RUN npm install --only=production
# Apache on 8080
COPY apache_ports.conf /etc/apache2/ports.conf
COPY apache_vhost.conf /etc/apache2/sites-available/000-default.conf
COPY web/html/ /var/www/html/
# nginx on 80
RUN rm -rf /etc/nginx/sites-enabled/default
COPY web/proxy/nginx.conf /etc/nginx/conf.d/default.conf
# DriveHealth on 5001
RUN mkdir -p /opt/DriveHealth
RUN python3 -m venv /opt/DriveHealth/venv
COPY apis/StorageSummary/requirements.txt /opt/DriveHealth/
RUN /opt/DriveHealth/venv/bin/pip3 install --no-cache-dir -r /opt/DriveHealth/requirements.txt
# Copy the actual app code after installing deps
COPY apis/StorageSummary/ /opt/DriveHealth/
# Add supervisord configuration
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Expose ports
EXPOSE 80
EXPOSE 6379
# healthcheck looks for apache
HEALTHCHECK CMD netstat -ltn | grep -c ":8080" > /dev/null; if [ 0 != $? ]; then exit 1; fi;
# Start supervisord
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]