Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Supercharging Development with Docker

Supercharging Development with Docker

Sheharyar Naseer

April 06, 2024
Tweet

More Decks by Sheharyar Naseer

Other Decks in Technology

Transcript

  1. Technology advisor & consultant for startups, and Manager at Google

    Developers Group Find me online @sheharyarn Sheharyar Naseer
  2. 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
  3. Scaling Systems • Processes need to mature with the Software

    • More complexity requires more moving parts • Different aspects: • Automating Processes • Expanding Infrastructure • Improving Development
  4. Automating Processes • Tasks increase and grow complex • Reduce

    manual intervention • Automate common steps • PeopleOps, DevOps, SecOps, DataOps, MLOps • Consistency
  5. 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
  6. 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
  7. Packaging Environments • Think about "environment" of your system •

    Reduce to bare essentials • Combine together & isolate from the rest • Two approaches: • Virtual Machines (VMs) • Containers
  8. Technology Verticals • Web & Mobile • ML / AI

    • Distributed Systems • Internet of Things • Mixed Reality • Cloud
  9. Containerization • Modern, cloud-native architecture • Smaller, portable and faster

    • Efficient and light-weight • Tools: • Docker • Podman
  10. 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
  11. Docker is the top-used tool amongst all Professional developers “

     StackOverflow Developer Survey 2023  2019 2020 2021 2022 69% 49% 39% 35%
  12. 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
  13. 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
  14. Docker – The Why • Ship code faster • Standardize

    operations • Save money • Simplify security • Run and deploy anywhere
  15. Docker – The How • Install Docker • Create a

    "Dockerfile" • Write steps to run app • Run it!
  16. 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"]
  17. 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"]
  18. CloudUp.dev • Dockerfile Generator • Maintained by GDG Lahore •

    Supports common languages • Guided steps https://cloudup.dev/
  19. 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
  20. Infrastructure Providers • Google Cloud Platform • Amazon Web Services

    • Heroku • DigitalOcean • Fly.io • and many more...
  21. 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 .
  22. Deploy with Cloud Run • Instantly deploy any container •

    Very simple UI • Deploy previously uploaded
  23. 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
  24. Questions?  @  shyr.io [email protected] @sheharyarn These Slides →

    shyr.io/t/dev-with-docker More Talks → shyr.io/talks