|
| 1 | +# use this empty Dockerfile to build your assignment |
| 2 | + |
| 3 | +# This dir contains a Node.js app, you need to get it running in a container |
| 4 | +# No modifications to the app should be necessary, only edit this Dockerfile |
| 5 | + |
| 6 | +# Overview of this assignment |
| 7 | +# use the instructions from developer below to create a working Dockerfile |
| 8 | +# feel free to add command inline below or use a new file, up to you (but must be named Dockerfile) |
| 9 | +# once Dockerfile builds correctly, start container locally to make sure it works on http://localhost |
| 10 | +# then ensure image is named properly for your Docker Hub account with a new repo name |
| 11 | +# push to Docker Hub, then go to https://hub.docker.com and verify |
| 12 | +# then remove local image from cache |
| 13 | +# then start a new container from your Hub image, and watch how it auto downloads and runs |
| 14 | +# test again that it works at http://localhost |
| 15 | + |
| 16 | + |
| 17 | +# Instructions from the app developer |
| 18 | +# - you should use the 'node' official image, with the alpine 6.x branch (node:6-alpine) |
| 19 | + # yes this is a 2-year old image of node, but all official images are always |
| 20 | + # available on Docker Hub forever, to ensure even old apps still work. |
| 21 | + # It is common to still need to deploy old app versions, even years later. |
| 22 | +# - this app listens on port 3000, but the container should launch on port 80 |
| 23 | + # so it will respond to http://localhost:80 on your computer |
| 24 | +# - then it should use alpine package manager to install tini: 'apk add --update tini' |
| 25 | +# - then it should create directory /usr/src/app for app files with 'mkdir -p /usr/src/app' |
| 26 | +# - Node uses a "package manager", so it needs to copy in package.json file |
| 27 | +# - then it needs to run 'npm install' to install dependencies from that file |
| 28 | +# - to keep it clean and small, run 'npm cache clean --force' after above |
| 29 | +# - then it needs to copy in all files from current directory |
| 30 | +# - then it needs to start container with command '/sbin/tini -- node ./bin/www' |
| 31 | +# - in the end you should be using FROM, RUN, WORKDIR, COPY, EXPOSE, and CMD commands |
| 32 | + |
| 33 | +# Bonus Extra Credit |
| 34 | +# this will not have you setting up a complete image useful for local development, test, and prod |
| 35 | +# it's just meant to get you started with basic Dockerfile concepts and not focus too much on |
| 36 | +# proper Node.js use in a container. **If you happen to be a Node.js Developer**, then |
| 37 | +# after you get through more of this course, you should come back and use my |
| 38 | +# Node Docker Good Defaults sample project on GitHub to change this Dockerfile for |
| 39 | +# better local development with more advanced topics |
| 40 | +# https://github.com/BretFisher/node-docker-good-defaults |
0 commit comments