Skip to content
Snippets Groups Projects
Dockerfile 1.07 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jonas Leder's avatar
    Jonas Leder committed
    FROM python:3
    
    
    LABEL Name=url_shorter
    
    Jonas Leder's avatar
    Jonas Leder committed
    EXPOSE 5000
    
    
    Jonas Leder's avatar
    Jonas Leder committed
    #Copy files to work directory
    
    Jonas Leder's avatar
    Jonas Leder committed
    WORKDIR /app
    ADD ./static /app/static
    ADD ./templates /app/templates
    COPY import.py /app/import.py
    COPY export.py /app/export.py
    COPY main.py /app/main.py
    
    COPY VERSION /app/VERISON
    
    Jonas Leder's avatar
    Jonas Leder committed
    
    
    #Make a complete system update. apt-utils is needed for configuring packages, so we need to install it
    
    Jonas Leder's avatar
    Jonas Leder committed
    RUN apt update
    
    Jonas Leder's avatar
    Jonas Leder committed
    RUN apt install apt-utils -y
    
    Jonas Leder's avatar
    Jonas Leder committed
    RUN apt upgrade -y
    
    Jonas Leder's avatar
    Jonas Leder committed
    
    
    Jonas Leder's avatar
    Jonas Leder committed
    #Install pipreqs. This tool is used to make the requirements.txt file automatic. Afterwards install them.
    
    Jonas Leder's avatar
    Jonas Leder committed
    RUN pip install pipreqs
    RUN pipreqs . --force
    RUN python3 -m pip install -r requirements.txt
    
    #Compile the Python files (for more speed) and replace the original files
    RUN python -m compileall .
    RUN rm main.py import.py export.py
    RUN mv __pycache__/main.* main.py
    RUN mv __pycache__/import.* import.py
    RUN mv __pycache__/export.* export.py
    
    #Make a builddate file, used if you want to see the builddate in the webui
    RUN date > builddate.txt
    
    #everytime the container starts run main.py
    
    Jonas Leder's avatar
    .  
    Jonas Leder committed
    ENTRYPOINT python3 main.py