Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

cisagov/apache2-docker

Repository files navigation

apache2-docker 🍂🐳

GitHub Build Status CodeQL Known Vulnerabilities

Docker Image

Docker Pulls Docker Image Size (latest by date) Platforms

This is a docker project that is used to spin up an apache2 web server.

Running

Running with Docker

To run the cisagov/apache2 image via Docker:

docker run cisagov/apache2:latest

Running with Docker Compose

  1. Use the docker-compose.yml file similar to the one below to use Docker Compose.

    ---
    version: "3.7"
    
    # This Docker composition file is used to build and test the container
    
    secrets:
      quote_txt:
        file: ./src/secrets/quote.txt
    
    services:
      http-redirector:
        # Run the container normally
        build:
          # VERSION must be specified on the command line:
          # e.g., --build-arg VERSION=0.0.1
          context: .
          dockerfile: Dockerfile
        image: cisagov/apache2:latest
        container_name: apache
        init: true
        restart: "no"
        ports:
         - '80:80'
         - '443:443'
       volumes:
         - ./src/:/var/www/html
          - ./src/config/apache2.conf:/etc/apache2/apache2.conf
          - ./src/config/000-default.conf:/etc/apache2/sites-available/000-default.conf
  2. Start the container and detach:

    docker compose up --detach

Updating your container

Docker Compose

  1. Pull the new image from Docker Hub:

    docker compose pull
  2. Recreate the running container by following the previous instructions:

    docker compose up --detach

Docker

  1. Stop the running container:

    docker stop <container_id>
  2. Pull the new image:

    docker pull cisagov/apache2:latest
  3. Recreate and run the container by following the previous instructions.

Volumes

Mount point Purpose
/src/ webroot
/src/config configuration of the server

Ports

The following ports are exposed by this container:

Port Purpose
80 http
443 https

The sample Docker composition publishes the exposed port at 80 & 443.

Required

There are no required environment variables.

Cross-platform builds

To create images that are compatible with other platforms, you can use the buildx feature of Docker:

  1. Copy the project to your machine using the Code button above or the command line:

    git clone https://github.com/cisagov/apache2-docker.git
    cd apache2-docker
  2. Create the Dockerfile-x file with buildx platform support:

    ./buildx-dockerfile.sh
  3. Build the image using buildx:

    docker buildx build \
      --file Dockerfile-x \
      --platform linux/amd64 \
      --output type=docker \
      --tag cisagov/apache2:latest.

New repositories from a skeleton

Please see our Project Setup guide for step-by-step instructions on how to start a new repository from a skeleton. This will save you time and effort when configuring a new repository!

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

This project is in the worldwide public domain.

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.