Skip to content
Snippets Groups Projects
Select Git revision
  • 16b690b6d198afc0b5bfd9aa1c96b008cb997921
  • main default protected
2 results

Dockerfile

Blame
  • user avatar
    Stefano Alberto Russo authored
    16b690b6
    History
    Dockerfile 1.92 KiB
    FROM ubuntu:18.04
    MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com>
    
    #----------------------
    # Basics
    #----------------------
    
    # Set non-interactive
    ENV DEBIAN_FRONTEND noninteractive
    
    # Update
    RUN apt-get update
    
    # Utilities
    RUN apt-get install -y nano telnet unzip wget openssh-server sudo curl
    
    # Devel
    RUN apt-get install -y build-essential python-dev git-core
    
    # Download get-pip script
    RUN curl -O https://bootstrap.pypa.io/pip/3.6/get-pip.py
    
    # Install Python3 and Pip3 (python3-distutils required for pip3)
    RUN apt-get install python3 python3-distutils -y 
    
    # Install Python3 and Pip3 (python3-distutils required for pip3)
    # Fix pip version to avoid future issues.
    RUN apt-get install python3 python3-distutils -y 
    RUN python3 get-pip.py 'pip==21.0.1'
    
    # Python 3 dev (for pycrypto)
    RUN apt-get install python3-dev -y
    
    # Install postgres driver required for psycopg2
    RUN apt-get install libpq-dev -y
    
    
    #------------------------
    # Esap user
    #------------------------
    
    # Add group. We chose GID 65527 to try avoiding conflicts.
    RUN groupadd -g 65527 esap
    
    # Add user. We chose UID 65527 to try avoiding conflicts.
    RUN useradd esap -d /esap -u 65527 -g 65527 -m -s /bin/bash
    
    # Add esap user to sudoers
    RUN adduser esap sudo
    
    # No pass sudo (for everyone, actually)
    COPY sudoers /etc/sudoers
    
    
    #------------------------
    # Code
    #------------------------
    
    RUN cd /opt && git clone https://git.astron.nl/astron-sdc/esap-api-gateway.git
    RUN cd /opt/esap-api-gateway && git pull && git checkout 557c921
    RUN chown -R esap:esap /opt/esap-api-gateway
    
    
    #------------------------
    # Dependencies
    #------------------------
    
    RUN pip3 install -r /opt/esap-api-gateway/esap/requirements/prod.txt
    RUN pip3 install uwsgi==2.0.19.1
    
    
    #----------------------
    # Entrypoint
    #----------------------
    
    COPY run_api-gateway.sh /run_api-gateway.sh
    COPY entrypoint.sh /entrypoint.sh
    RUN chmod 755 /entrypoint.sh /run_api-gateway.sh
    
    USER esap
    ENTRYPOINT ["/entrypoint.sh"]