Created
April 4, 2022 10:15
-
-
Save esirK/066c394a998f85534bc2a54cb113ae05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu@sha256:9c152418e380c6e6dd7e19567bb6762b67e22b1d0612e4f5074bda6e6040c64a as ubuntu-22.04 | |
RUN apt update && apt upgrade -y | |
RUN apt install -y wget build-essential zlib1g-dev libssl-dev | |
# Install Python | |
RUN wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz && \ | |
tar xzf Python-3.10.2.tgz && \ | |
cd Python-3.10.2 && \ | |
./configure --enable-optimizations && \ | |
make install && \ | |
cd .. && \ | |
rm -rf Python-3.10.2* | |
# It is likely that we'll run a Python script somewhere in the final app. By default, Python will buffer lines print()ed to STDOUT / STDERR, and they might end up in container's log after a delay and with a wrong timestamp (e.g. log messages). So, disable such buffering altogether to all containers by default. | |
# Don't create .pyc files | |
ENV DEBIAN_FRONTEND noninteractive\ | |
PYTHONUNBUFFERED=1\ | |
PYTHONDONTWRITEBYTECODE=1 | |
# Common requirements | |
COPY src/requirements.txt /tmp/requirements.txt | |
RUN pip3 install -r /tmp/requirements.txt && rm /tmp/requirements.txt && rm -rf /root/.cache/ | |
# create a custom user to prevent security issues of running as root https://docs.docker.com/engine/security/rootless/ | |
RUN useradd -m -s /bin/bash cfa | |
# Create a directory where common source code will be stored | |
RUN mkdir -p /opt/cfa/src && \ | |
ln -s /opt/cfa/src /cfa | |
COPY src/ /opt/cfa/src/common | |
ENV PYTHONPATH /opt/cfa/src/common/python |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment