Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Stand Up the Lab: Two Servers, a Cluster, and an App to Deploy
25%

The Container

Let's create a Docker image for our todo application. We start by creating a Dockerfile. Use the following command to create the file:

cat << EOF > $HOME/todo/app/Dockerfile
# Use an official Python runtime as a parent image
FROM python:3.12-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Run the application
CMD ["python", "app.py"]
EOF

Create a .dockerignore file to exclude unnecessary files from the Docker build context:

cat << EOF > $HOME/todo/app/.dockerignore
.git
.gitignore
__pycache__
venv
tests
Dockerfile
EOF

Install Docker:

# Download the Docker installation script
curl -fsSL https://get.docker.com -o get-docker.sh

# Run the Docker installation script 
# and remove it after installation
sh get-docker.sh && rm get-docker.sh

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.