github.com/mutagen-io/mutagen@v0.18.0-rc1/scripts/ci/setup_docker.sh (about)

     1  #!/bin/bash
     2  
     3  # Exit immediately on failure.
     4  set -e
     5  
     6  # Print Docker version information.
     7  docker version
     8  
     9  # Determine the operating system.
    10  MUTAGEN_OS_NAME="$(go env GOOS)"
    11  
    12  # Verify that the platform is supported and compute the executable extension.
    13  if [[ "${MUTAGEN_OS_NAME}" == "linux" ]]; then
    14      MUTAGEN_EXE_EXT=""
    15  elif [[ "${MUTAGEN_OS_NAME}" == "windows" ]]; then
    16      MUTAGEN_EXE_EXT=".exe"
    17  else
    18      # TODO: We might eventually be able to support macOS if Docker for Mac (or
    19      # something similar) is available on the CI system we're using.
    20      echo "Docker CI setup not supported on this platform" 1>&2
    21      exit 1
    22  fi
    23  
    24  # Build the HTTP demo server that will serve as the Dockerfile entry point. We
    25  # disable cgo to avoid creating dependencies on host libraries (such as glibc on
    26  # Linux) that might not exist inside the container.
    27  CGO_ENABLED=0 go build \
    28      -o "scripts/ci/docker/${MUTAGEN_OS_NAME}/httpdemo${MUTAGEN_EXE_EXT}" \
    29      github.com/mutagen-io/mutagen/pkg/integration/fixtures/httpdemo
    30  
    31  # Build our image.
    32  docker image build --pull --tag mutagentest "scripts/ci/docker/${MUTAGEN_OS_NAME}"
    33  
    34  # Start a container.
    35  docker container run --name mutagentester --detach mutagentest