Repository: crccheck/docker-hello-world Branch: master Commit: bbed28cb7755 Files: 5 Total size: 3.1 KB Directory structure: gitextract_p9pbpc8v/ ├── .github/ │ └── workflows/ │ └── publish.yml ├── .travis.yml ├── Dockerfile ├── README.md └── index.html ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/publish.yml ================================================ name: Publish Docker image on: release: types: [published] jobs: push_to_registry: name: Push Docker image to Docker Hub runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v2 - name: Extract metadata (tags, labels) for Docker id: meta # https://github.com/docker/metadata-action uses: docker/metadata-action@v3 with: images: crccheck/hello-world - name: Log in to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push # https://github.com/docker/build-push-action uses: docker/build-push-action@v2 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} ================================================ FILE: .travis.yml ================================================ services: - docker branches: only: - master before_install: - docker build -t hello-world . - docker run -d -p 127.0.0.1:8000:8000 hello-world script: - docker ps | grep hello-world - curl --fail localhost:8000 - curl --fail -I localhost:8000 ================================================ FILE: Dockerfile ================================================ FROM busybox:latest ENV PORT=8000 LABEL maintainer="Chris " ADD index.html /www/index.html # EXPOSE $PORT HEALTHCHECK CMD nc -z localhost $PORT # Create a basic webserver and run it until the container is stopped CMD echo "httpd started" && trap "exit 0;" TERM INT; httpd -v -p $PORT -h /www -f & wait ================================================ FILE: README.md ================================================ # Hello World This is a simple Docker image that just gives http responses on port 8000. It's small enough to fit on one floppy disk: ```bash $ docker images | grep hell REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE crccheck/hello-world latest 2b28c6ad8d1b 4 months ago 1.2MB ``` I made this initially because there were lots of scenarios where I wanted a Docker container that speaks HTTP, but every guide used images that took seconds to download. Armed with a tiny Docker image, I could test things in a fresh environment in under a second. I like faster feedback loops. **THANK YOU** to the surprisingly large number of contributors that have made this better for everyone over the years. ## Sample Usage ### Starting a web server on port 80 ```bash $ docker run -d --rm --name web-test -p 80:8000 crccheck/hello-world ``` You can now interact with this as if it were a dumb web server: ``` $ curl localhost Hello World ...snip... ``` ``` $ curl -I localhost HTTP/1.0 200 OK ``` ``` $ curl -X POST localhost/super/secret <HTML><HEAD><TITLE>501 Not Implemented</TITLE></HEAD> ...snip... ``` ``` $ curl --write-out %{http_code} --silent --output /dev/null localhost 200 ``` ================================================ FILE: index.html ================================================ <pre> Hello World ## . ## ## ## == ## ## ## ## ## === /""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o _,/ \ \ _,' `'--.._\..--'' </pre>