Open maxachis opened 5 days ago
Notes to eventually include in Notion:
Dockerfiles are text files which run a series of commands in order to build a Docker image.
Dockerfiles are used in the deployment of Jenkins builds, alongside Jenkinsfiles. Through Dockerfiles, we're able to ensure a consistent and repeatable environment that is contained in isolation from the rest of the environment. This enables more secure deployments as well as aids testing by helping to avoid the "Works On My Machine" problem.
In repositories which utilize Jenkins builds, a Dockerfile
should be included in the root directory, along with a Jenkinsfile
, containing the setup details for the requisite environment. Examples can be found in other repositories which are utilized in the Automation Manager.
# Install dependencies necessary for add-apt-repository
RUN apt-get install software-properties-common -y
# Install Python and pip
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y \
python3.11 \
python3-pip
# This section ensures that the Python package installation built inside the Dockerfile
# is accessible within the container.
COPY requirements.txt /opt/app/requirements.txt
WORKDIR /opt/app
RUN pip install --no-cache-dir -r requirements.txt --break-system-packages
COPY . /opt/app
[To fill in more later].
Building directly on the Jenkins build server poses a few problems, which using Docker Containers will help mitigate.
Steps required