3.0.0 • Published 12 months ago

@ebizbase/nx-docker v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

nx-docker

The NX plugin to build, push containers, and analyze images from your applications

Prerequisites

  • Ensure you have Docker installed and running on your machine.
  • Ensure you have NX installed in your workspace.

Installation

To install plugin run the following command:

npm install -D @ebizbase/nx-docker
yarn add -D @ebizbase/nx-docker
pnpm add -D @ebizbase/nx-docker

Build image

Note: Docker have been deprecated docker build which requires the Buildx component to build images with BuildKit. So from now on we will not support docker build related issues. And in the future we will require buildx to be installed.

Bellow config simple build docker image and load it in local registry. You can see image with docker image ls after build.

{
  "targets": {
    "build": {
      "executor": "@ebizbase/nx-docker:build",
      "options": {
        "tags": ["your-app:latest"],
        "outputs": ["type=image"]
      }
    }
  }
}

If you want to build and push image let referance bellow example

{
  "targets": {
    "build": {
      "executor": "@ebizbase/nx-docker:build",
      "options": {
        "tags": ["docker.io/org/your-app:latest", "ghcr.io/ogr/your-app:latest"],
        "outputs": ["type=registry"]
      }
    }
  }
}

Let's see more about docker buildx build output options

Bellow is all options of @ebizbase/nx-docker:build

PropertyTypeDescriptionDefaultRequired
cibooleanRun in CI modefalseNo
outputsstring[]The output of the buildNo
argsstring[]The arguments to pass to the docker build commandNo
filestringThe dockerfile to use for building the imageNo
contextstringThe context to use for building the imageNo
tagsstring[]The tag of the image to buildYes
addHoststring[]Add a custom host-to-IP mapping (host:ip)No
allowstring[]Allow extra privileged entitlement (e.g., network.host, security.insecure)No
annotationstring[]Set metadata for an imageNo
atteststring[]Attest the image with an attestation providerNo
cacheFromstring[]Images to consider as cache sourcesNo
cacheTostring[]Images to consider as cache destinationsNo
shm-sizestringSize of /dev/shmNo
targetstringSet the target build stage to buildNo
ulimitstring[]Ulimit optionsNo
platformstring[]Set the target platform for the buildNo
ulimitstring[]The metadata will be written as a JSON object to the specified file.No

shm-size and ulimit are only available using moby/buildkit:master as builder image atm:

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v1
  with:
  driver-opts: |
    image=moby/buildkit:master

To check all possible options please check this schema.json file

License

This project is licensed under the MIT License.

3.0.0

12 months ago

2.0.0

12 months ago

1.4.6

12 months ago

1.4.5

12 months ago

1.4.4

12 months ago

1.4.3

12 months ago

1.4.2

12 months ago

1.4.1

12 months ago

1.4.0

12 months ago

1.3.0

12 months ago

1.2.0

12 months ago

1.1.0

12 months ago

1.0.0

12 months ago