'plugin install' does nothing in Dockerfile #7727
-
|
I'm using Dockerfile: FROM pulumi/pulumi-nodejs:latest AS production
COPY --from=alpine/helm:latest /usr/bin/helm /usr/bin/helm
RUN apt-get update -y && \
apt-get install -y \
jq && \
rm -rf /var/lib/apt/lists/*
COPY package-lock.json .
RUN pulumi plugin install resource digitalocean $(cat package-lock.json | jq --raw-output '.dependencies."@pulumi/digitalocean".version') --exact
RUN pulumi plugin install resource kubernetes $(cat package-lock.json | jq --raw-output '.dependencies."@pulumi/kubernetes".version') --exactI tried adding I exec into container with .PHONY: pulumi
pulumi:
docker run -it \
-u 1000:1000 \
-v $$(pwd):/pulumi/projects \
--env-file=pulumi.env \
$$(docker build --target=production -q .) \
/bin/bashOutput of Am I missing something or there is a potential issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Nothing wrong with Pulumi. Easy fix is to add A bit more advanced technique is to change In my case I did: |
Beta Was this translation helpful? Give feedback.
Nothing wrong with Pulumi.
After finding out that Pulumi stores plugin files in the current user's home directory (
nodein case of docker withpulumi-nodejsimage) I knew what the problem is.Apparently the problems is with permissions (or plugin directory location). Since during
docker buildcurrent user isroot, plugins would install to/root/.pulumi/plugins.Current user inside container (after
docker exec) isnode. Pulumi thinks install location is/home/node/.pulumi/plugins) and that location has no plugins.Easy fix is to add
USER nodedirective before anypulumicommand.A bit more advanced technique is to change
PULUMI_HOMEenvironment variable and thenchowntonodeuser after e…