dockerInstructions stage
docker:
  VOLUME:
  - <volume>
  EXPOSE:
  - <expose>
  ENV:
    <env_name>: <env_value>
  LABEL:
    <label_name>: <label_value>
  ENTRYPOINT: <entrypoint>
  CMD: <cmd>
  WORKDIR: <workdir>
  USER: <user>
  HEALTHCHECK: <healthcheck>

Dockerfile instructions can be divided into two groups: build-time instructions and other instructions that effect on an image manifest. Build-time instructions do not make sense in a werf build process. Therefore, werf supports only following instructions:

  • USER to set the user and the group to use when running the image (read more here).
  • WORKDIR to set the working directory (read more here).
  • VOLUME to add mount point (read more here).
  • ENV to set the environment variable (read more here).
  • LABEL to add metadata to an image (read more here).
  • EXPOSE to inform Docker that the container listens on the specified network ports at runtime (read more here)
  • ENTRYPOINT to configure a container that will run as an executable (read more here).
  • CMD to provide default arguments for the ENTRYPOINT to configure a container that will run as an executable (read more here).
  • HEALTHCHECK to tell Docker how to test a container to check that it is still working (read more here)

These instructions can be specified in the docker config directive.

Here is an example of using docker instructions:

docker:
  WORKDIR: /app
  CMD: ['python', './index.py']
  EXPOSE: '5000'
  ENV:
    TERM: xterm
    LC_ALL: en_US.UTF-8

Defined docker instructions are applied on the last stage called docker_instructions. Thus, instructions do not affect other stages, ones just will be applied to a built image.

If need to use special environment variables in build-time of your application image, such as TERM environment, you should use a base image with these variables.

Tip: you can also implement exporting environment variables right in user stage instructions