From 0a7db06de67d1c166264695290bf01b54cb20dc9 Mon Sep 17 00:00:00 2001 From: Giorgia Rondinini Date: Wed, 19 Feb 2020 20:23:54 +0100 Subject: [PATCH] Add support for docker --- stack.yaml | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/stack.yaml b/stack.yaml index 2fbaddb..64dd5ea 100644 --- a/stack.yaml +++ b/stack.yaml @@ -69,3 +69,106 @@ extra-deps: # # Allow a newer minor version of GHC than the snapshot specifies # compiler-check: newer-minor + +docker: + # Set to false to disable using Docker. In the project configuration, + # the presence of a `docker:` section implies docker is enabled unless + # `enable: false` is set. In user and global configuration, this is not + # the case. + enable: true + + # The name of the repository to pull the image from. See the "repositories" + # section of this document for more information about available repositories. + # If this includes a tag (e.g. "my/image:tag"), that tagged image will be + # used. Without a tag specified, the LTS version slug is added automatically. + # Either `repo` or `image` may be specified, but not both. + repo: "fpco/haskell-scratch:integer-gmp" + + # Exact Docker image name or ID. Overrides `repo`. Either `repo` or `image` + # may be specified, but not both. (default none) + # image: "5c624ec1d63f" + + # Registry requires login. A login will be requested before attempting to + # pull. + registry-login: false + + # Username to log into the registry. (default none) + # registry-username: "myuser" + + # Password to log into the registry. (default none) + # registry-password: "SETME" + + # If true, the image will be pulled from the registry automatically, without + # needing to run `stack docker pull`. See the "security" section of this + # document for implications of enabling this. + auto-pull: true + + # If true, the container will be run "detached" (in the background). Refer + # to the Docker users guide for information about how to manage containers. + # This option would rarely make sense in the configuration file, but can be + # useful on the command-line. When true, implies `persist`. + detach: true + + # If true, the container will not be deleted after it terminates. Refer to + # the Docker users guide for information about how to manage containers. This + # option would rarely make sense in the configuration file, but can be + # useful on the command-line. `detach` implies `persist`. + persist: true + + # What to name the Docker container. Only useful with `detach` or + # `persist` true. (default none) + container-name: "webserver-docker" + + # Additional arguments to pass to `docker run`. (default none) + run-args: ["--net=bridge"] + + # Directories from the host to volume-mount into the container. If it + # contains a `:`, the part before the `:` is the directory on the host and + # the part after the `:` is where it should be mounted in the container. + # (default none, aside from the project and stack root directories which are + # always mounted) + mount: + # - "/foo/bar" + # - "/baz:/tmp/quux" + + # Sets the volume mount mode, passed directly to `docker`. + # The default mode (consistent) is safest, but may suffer poor performance + # on non-Linux platforms such as macOS, where the `delegated` mode will + # be significantly faster. + # See https://docs.docker.com/docker-for-mac/osxfs-caching/ + # for valid values and the implications of changing the default. + mount-mode: delegated + + # Environment variables to set in the container. Environment variables + # are not automatically inherited from the host, so if you need any specific + # variables, use the `--docker-env` command-line argument version of this to + # pass them in. (default none) + env: + # - "FOO=BAR" + # - "BAR=BAZ QUUX" + + # Location of a Docker container-compatible 'stack' executable with the + # matching version. This executable must be compatible with the Docker + # image in terms of platform (linux-x86_64) and shared libraries + # (statically linked is best, otherwise the image needs to have the + # same shared libraries installed). + # Valid values are: + # host: use the host's executable. This is the default when the host's + # executable is known to work (e.g., from official linux-x86_64 bindist) + # download: download a compatible executable matching the host's version. + # This is the default when the host's executable is not known to work + # image: use the 'stack' executable baked into the image. The version + # must match the host's version + # /path/to/stack: path on the host's local filesystem + stack-exe: host + + # If true (the default when using the local Docker Engine), run processes + # in the Docker container as the same UID/GID as the host. The ensures + # that files written by the container are owned by you on the host. + # When the Docker Engine is remote (accessed by tcp), defaults to false. + set-user: true + + # Require the version of the Docker client to be within the specified + # Cabal-style version range (e.g., ">= 1.6.0 && < 1.9.0") + require-docker-version: ">= 1.6.0" +