Challenge 1: Containerize the web application

Next Challenge

Introduction

You’ve just started working as a DevOps Engineer for a company that hosts servers for different games. The company has been running game servers in Google Compute Engine across different Managed Instance Groups which has been working great so far, but occasionally the Testing team fails to setup their local environments correctly and end up approving bad code. The teams have been learning about containers, and are excited to start using them so they no longer have to deal with environment issues.

You have been assigned the Dungeon Crawl Stone Soup workload. Your team is looking to you to containerize the latest version of the game with Docker, verify that it plays, and host it in Artifact Registry.

Here are some helpful terms to know for this section:

  • Image - prepackaged files, code, and commands for running an application. And images are reusable, so once you’ve got it you can take it wherever you want to!
  • Container - an active, running image
  • Dockerfile - the set of instructions to build your image

You can read more about these terms by folowing the What is a container? and What is a Dockerfile? links in the Learning Resources section below.

Description

In this challenge, you will write a Dockerfile to create an image for the web game, Dungeon Crawl Stone Soup and after creating and testing the image, push it to Artifact Registry.

You can find an excellent sample Dockerfile by following the Multi-Stage Dockerfiles link in the Learning Resources section below.

To help you be successful, here are some reminders of things you will need to do:

  • Download the application code
  • Compiling DCSS with make WEBTILES=y command will take 25+ minutes. Compile the code on your host machine and create your image from the compiled code to save time on your builds. Work on your Dockerfile while this compiles!
  • Create a Dockerfile in the same directory as the application that will do selects a base image, install needed packages and files, and start the application
  • Run a Docker build to build a container image
  • Create and test a local container before pushing to Artifact Registry or dockerhub

Success Criteria

  • Verify your Docker image is smaller than 600MB
  • Demonstrate you can play the game on a container created from your image
  • Demonstrate that you can SSH into your running container
  • Verify your container image is in Artifact Registry

Learning Resources

Tips

  • Multi-Stage Dockerfiles are important for keeping your image size down. You can always write your Dockerfile as a single stage, and then break it up once you’ve got the containerized application working.

Advanced Challenges

Too comfortable? Eager to do more? Try these additional challenges!

  • Re-write your Dockerfile to compile the code

Next Challenge