# Docker

# Dockerfile guidelines

  • Always specify major and minor versions for FROM. Example, FROM php:8.2-fpm-alpine3.15.
  • Use COPY --link (opens new window) to use Docker's cache.
  • Use --target (opens new window) to extend Dockerfile for development. For example, to add xdebug.
  • If you have to inject any secret to the image, use (RUN --mount=type=secret)[https://render.com/docs/docker-secrets]. Example:
RUN --mount=type=secret,id=auth.json,dst=$COMPOSER_HOME/auth.json,required composer install --no-dev --no-scripts --no-autoloader --no-progress --no-interaction
    --mount=type=cache,target=/var/cache/apt \
    apt-get update && apt-get install -y git

# Helpful tools

See more security recommendations.