Slide 1

Slide 1 text

GDSC • Build With Gemini • Peshawar, 2024 Using Docker for your applications

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 Beyond Local Docker: What, Why & How Deploying to the Cloud Live Demo Learning Resources Q&A

Slide 5

Slide 5 text

Beyond Local SCALING YOUR APP

Slide 6

Slide 6 text

Beyond Local • Local development is the first step • More complexity requires more moving parts • Different aspects: • Implementing a dedicated backend • Scaling existing backend systems • Development reliability across teams

Slide 7

Slide 7 text

Adding a Backend • Gemini and other APIs are backends too • So Why? • Offload complexity • Data syncing • Validations and Pre- and Post-processing • Security concerns

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Scaling Existing Backends • Even more complexity • Increasing performance • Different microservices • Splitting responsibilities • Single endpoint vs multiple

Slide 10

Slide 10 text

Team Dev Environments • Multiple devs working on the same codebase • "But works on my machine!" • Consistent development environment • Reproducible issues • Focus on development

Slide 11

Slide 11 text

Docker THE WHAT, WHY AND HOW

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Docker – The What • "An open-source platform for containerizing applications and environments" • Docker Image: • Set of commands describing how to run your app • Write once, run anywhere • The "ABCs" of your Cloud journey

Slide 14

Slide 14 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 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Example – Java App FROM openjdk:8-jdk-alpine # Copy code WORKDIR /app COPY . . # Compile app RUN ./gradlew build RUN mv ./build/libs/*.jar ./app.jar # Start app CMD ["java", "-jar", "/app/app.jar"]

Slide 18

Slide 18 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 19

Slide 19 text

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

Slide 20

Slide 20 text

Build and Run # Run Java App docker build -t demo-java:v1 . docker run -it -p 8080:8080 demo-java:v1 # Run Python App docker build -t demo-python:v1 . docker run -it -p 5000:5000 demo-python:v1

Slide 21

Slide 21 text

Live Demo DOCKER IN ACTION

Slide 22

Slide 22 text

Deploying to the Cloud MADE EASY WITH DOCKER

Slide 23

Slide 23 text

Supported Tooling • Docker on OS • Container management tools • Kubernetes • Serverless

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

GCP + Docker • World-class support for Docker • Cloud-native tooling • Build, Deploy and Run any Docker image • Simple experience

Slide 26

Slide 26 text

Save to Cloud Registry # 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 27

Slide 27 text

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

Slide 28

Slide 28 text

Live Demo DEPLOYING TO GCP

Slide 29

Slide 29 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 30

Slide 30 text

Q/A These Slides → shyr.io/t/using-docker More Talks → shyr.io/talks  @  shyr.io [email protected] @sheharyarn