Skip to content

Build Image

Evil Wizard edited this page Nov 7, 2023 · 3 revisions

Build the Docker Image without using cached versions of previous image build stages.

The long Way

sudo docker build \
    -f php-7-2-fpm.Dockerfile \
    --target build-php-7-2-fpm \
    --build-arg APP_ENV=local \
    --build-arg NPM_VERSION=7.24.2 \
    --no-cache \
    -t php-7-2-fpm:latest \
    .

Notes

  • Using -f php-7-2-fpm.Dockerfile

    To specify php-7-2-fpm.Dockerfile as the filename to build otherwise it is expected to be named just Dockerfile.

  • Using --target build-php-7-2-fpm

    To select the build target stage[^multi_stage_builds_note] from the Dockerfile.

  • Using --no-cache

    To prevent using previous cached versions of image build stages.

  • Using --build-arg NPM_VERSION=7.24.2

    To set build arguments & values to use during the build process. NPM_VERSION=7.24.2 sets the Node Version to be used to 7.24.2 when rebuilding the image.

  • Using -t php-7-2-fpm:latest

    To name & tag the locally built docker image.

  • Using .

    To set the current location as the build context for the build process.

Clone this wiki locally