# Use python 3.9.2-slim as base image
FROM python:3.9.2-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 postgresql-client && apt-get -y install 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
COPY vos_data vos_import vos_storage /usr/bin/
RUN chmod 755 /usr/bin/vos_data && \
    chmod 755 /usr/bin/vos_import && \
    chmod 755 /usr/bin/vos_storage
    
# 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
