Skip to content

Allow custom command line when building in Docker #307

@mbklein

Description

@mbklein

Is your request related to a problem? Please describe.

I need to build my npm dependencies in Docker using a command other than npm install (e.g., npm install --only prod --no-bin-links), but build_in_docker is ignored for npm dependencies unless the build command is specifically npm (and nothing more).

For example, the following builds, zips, and deploys with the build using Docker, but with the command npm install.

build_in_docker = true
source_path       = "path/to/my/javascript/lambda"

The following builds, zips, and deploys without using Docker:

build_in_docker = true
source_path       = [
  {
    path     = "path/to/my/javascript/lambda"
    commands = ["npm install --only prod --no-bin-links --no-fund", ":zip"]
  }
]

Describe the solution you'd like.

I'd like to be able to specify that I want my dependencies to build in Docker and use the custom build command I specify. I'd think this could be accomplished by checking to see if the specific command being run starts with npm instead of requiring that it be npm alone.

Describe alternatives you've considered.

I've considered trying to include the docker run... part of the command in my custom build command, but that seems like it would forfeit some of this module's most valuable functionality.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions