Slide 1

Slide 1 text

GDSC • Build With Gemini • Karachi, 2024 Supercharging Development with Docker

Slide 2

Slide 2 text

Technology advisor & consultant for startups, and Manager at Google Developers Group Find me online @sheharyarn Sheharyar Naseer

Slide 3

Slide 3 text

Background • Indie Nomad Software Architect • 13+ years of polyglot experience, focus on Web & Cloud • StackOverflow: 70,000+ score (Top 5 in Pakistan) • Author / Contributor of multiple famous libraries & tools • Featured on popular developer communities

Slide 4

Slide 4 text

Outline Scaling Systems Packaging Environments Docker: What, Why & How Live Demo Learning Resources Q&A

Slide 5

Slide 5 text

Scaling Systems THE CHALLENGE

Slide 6

Slide 6 text

Scaling Systems • Processes need to mature with the Software • More complexity requires more moving parts • Different aspects: • Automating Processes • Expanding Infrastructure • Improving Development

Slide 7

Slide 7 text

Automating Processes • Tasks increase and grow complex • Reduce manual intervention • Automate common steps • PeopleOps, DevOps, SecOps, DataOps, MLOps • Consistency

Slide 8

Slide 8 text

Expanding Infrastructure • Track and manage growing infra • Increase performance • Add more components or features • Configure more tooling & hardware • Keep systems secure & working • Consistent and reliable behaviour

Slide 9

Slide 9 text

Improving Development • Onboarding developers faster • Consistent development environments • Multiple devs working on the same codebase • "But works on my machine!" • Reproducible issues • Focus on development

Slide 10

Slide 10 text

Packaging Environments WITH VMS & CONTAINERS

Slide 11

Slide 11 text

Packaging Environments • Think about "environment" of your system • Reduce to bare essentials • Combine together & isolate from the rest • Two approaches: • Virtual Machines (VMs) • Containers

Slide 12

Slide 12 text

Thinking in Environments Development Build

Slide 13

Slide 13 text

Thinking in Environments Development Testing Build Staging Production

Slide 14

Slide 14 text

Technology Verticals • Web & Mobile • ML / AI • Distributed Systems • Internet of Things • Mixed Reality • Cloud

Slide 15

Slide 15 text

Virtualization • Traditional architecture • Emulate Physical Computers • Resource-intensive • Tools: • VMWare • VirtualBox

Slide 16

Slide 16 text

Containerization • Modern, cloud-native architecture • Smaller, portable and faster • Efficient and light-weight • Tools: • Docker • Podman

Slide 17

Slide 17 text

Host Operating System Hypervisor Guest OS Guest OS Guest OS App App App Runtime Runtime Runtime Host Operating System Container Engine Runtime Runtime App App App vs Virtualization Containerization

Slide 18

Slide 18 text

Docker THE WHAT, WHY AND HOW

Slide 19

Slide 19 text

Docker is the top-used tool amongst all Professional developers “  StackOverflow Developer Survey 2023  2019 2020 2021 2022 69% 49% 39% 35%

Slide 20

Slide 20 text

Docker – The What • "An open-source platform for containerizing applications and environments" • Docker Image: • Set of commands describing how to run your app • Docker Container: • Your commands executed • Can run anywhere

Slide 21

Slide 21 text

Docker – The Why • Imagine buying a new computer • You set it up and install apps • Run system updates, etc. • Software: • Repeat steps on every fresh deploy • Manually run updates • Fix broken steps

Slide 22

Slide 22 text

Docker – The Why • Ship code faster • Standardize operations • Save money • Simplify security • Run and deploy anywhere

Slide 23

Slide 23 text

Docker – The How • Install Docker • Create a "Dockerfile" • Write steps to run app • Run it!

Slide 24

Slide 24 text

Example – Python App FROM python:3 # Set the app directory WORKDIR /app COPY . . # Install dependencies RUN pip3 install -r requirements.txt # Start app EXPOSE 5000 CMD ["python3", "-m", "flask", "run", "--host=0.0.0.0"]

Slide 25

Slide 25 text

Example – Flutter App FROM fischerscode/flutter:3.22 # Set the development directory WORKDIR /dev COPY . . # Install dependencies RUN flutter pub get # Start app CMD ["flutter", "run"]

Slide 26

Slide 26 text

CloudUp.dev • Dockerfile Generator • Maintained by GDG Lahore • Supports common languages • Guided steps https://cloudup.dev/

Slide 27

Slide 27 text

Build and Run # Build the image docker build -t my-app:v1 . # Run the app docker run -it -p 5000:5000 my-app:v1 # Run for different envs docker run -it my-app:v1 --env-file stage.env docker run -it my-app:v1 --env-file prod.env

Slide 28

Slide 28 text

Live Demo DOCKER IN ACTION

Slide 29

Slide 29 text

Running in the Cloud MADE EASY WITH DOCKER

Slide 30

Slide 30 text

Supported Tooling • Docker on OS • Container management tools • CI/CD • Serverless

Slide 31

Slide 31 text

Infrastructure Providers • Google Cloud Platform • Amazon Web Services • Heroku • DigitalOcean • Fly.io • and many more...

Slide 32

Slide 32 text

Save to Google Cloud # Setup gcloud login gcloud config project set ${PROJECT_ID} # Build and Save Image gcloud builds submit \ --tag=gcr.io/${PROJECT_ID}/my-app:v1 .

Slide 33

Slide 33 text

Deploy with Cloud Run • Instantly deploy any container • Very simple UI • Deploy previously uploaded

Slide 34

Slide 34 text

Live Demo DEPLOYING TO GCP

Slide 35

Slide 35 text

Helpful Resources KEEP LEARNING Docker • Official Docs: docs.docker.com • Friendly Guides: vsupalov.com/docker • Dockerfile Generator: cloudup.dev Google Cloud • GCP Container Registry: gcr.io

Slide 36

Slide 36 text

Questions?  @  shyr.io [email protected] @sheharyarn These Slides → shyr.io/t/dev-with-docker More Talks → shyr.io/talks