# Use python 3.9.4-slim as base image
FROM python:3.9.4-slim

# Install psql client to be able to connect manually to the file_catalog container
# Install also redis-tools to be able to access the redis container via redis-cli
RUN apt-get -y update && apt-get -y install screen postgresql-client redis-tools 

# Create a new user called 'client', create the home directory and set the default shell
RUN useradd -m -s /bin/bash client

# Copy the source code of all client apps
RUN mkdir -p /usr/bin/vos_cli
COPY *.py \
     vos_data \
     vos_import \
     vos_job \
     vos_storage /usr/bin/vos_cli/
RUN chmod -R 755 /usr/bin/vos_cli

# Copy configuration file
RUN mkdir -p /etc/vos_cli
COPY config/vos_cli.conf /etc/vos_cli/
RUN chmod -R 755 /etc/vos_cli

# Set the PAH environment variable
ENV PATH "$PATH:/usr/bin/vos_cli"    
    
# Run commands as 'client' user
USER client

# Set up a workdir for the container
WORKDIR /home/client/

# Install python dependencies
RUN pip3.9 install --no-cache-dir pika tabulate
