My journey using Docker as a development tool
- Wicklow Hall 1
- 14:30 on 13 July 2022
- 30 minutes
I have been programming in Python for 5 years and almost from day one I've been using Docker with Python. Docker is now a widely used tool across the industry, due to its flexibility. It can be used as a tool to help deploy your code in production, say using Kubernetes. It can also be used as a tool to help develop code locally, with tools such as docker-compose.
It has taken me some time to discover various features and best practices when using Docker. Especially when it comes to using it for local development.
In this talk, I would like to go over a journey I have taken with Docker whilst working with it over several years. Starting from a single build step with a full-fat image, going over multi-stage Docker images. Showing you how you can use the same Dockerfile for development and production.
Docker is a prevalent tool in our industry today, it is widely used for several proposes. In this talk, I would like to describe the journey I have taken with Docker and how I have learnt to use it with Python for local development. The talk will mostly focus on how we can use Docker to run all of our development tasks, so we hardly need to have anything installed locally. To the point where you can work on almost any project with nothing more than an editor, your terminal and docker.
We will look at how we can take a simple FastAPI CRUD web service and Dockerise it. The talk will be a step by step guide, starting of with a simple Docker image and improving it iteratively.
- Firstly use a simple Docker image
- Then add docker-compose to dockerise its dependencies such as database
- Then see how we can run tests (and other tasks) directly in our Docker container (using Makefiles)
- How to use this with Github Action
- Then look at multistage builds briefly
- Then split this into development and production image
- Finally, look at using Poetry to manage our dependencies
- How can we handle git dependencies that require an SSH key to be injected into the Docker image at build time
I’d be a little more specific. Like, how we handle private pip packages in our docker images.
This talk is for you if you are a casual user of Docker and know a few of its features but want to improve your Docker skills.
This is NOT a talk for you if you are an expert in Docker and know most of its features.