mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 07:22:22 +00:00
3cff091e3a
Change-type: patch Signed-off-by: Kyle Harding <kyle@balena.io>
44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
ARG BUILD_BASE=balenalib/amd64-debian-node:12.19.1-build
|
|
ARG RUN_BASE=balenalib/amd64-debian-node:12.19.1-run
|
|
|
|
FROM ${BUILD_BASE} as build
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY . .
|
|
|
|
# dev dependencies are required for build:fast
|
|
# --unsafe-perm is not needed because of global /usr/local/etc/npmrc
|
|
RUN npm install
|
|
|
|
RUN npm run build:fast
|
|
|
|
# remove dev dependencies after build:fast
|
|
RUN npm prune --production
|
|
|
|
FROM ${RUN_BASE}
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY --from=build /usr/src/app/ .
|
|
|
|
ENV PATH $PATH:/usr/src/app/bin
|
|
|
|
# fail early if balena binary won't run
|
|
RUN balena --version
|
|
|
|
# https://github.com/balena-io/balena-cli/blob/master/INSTALL-LINUX.md#additional-dependencies
|
|
RUN install_packages avahi-daemon ca-certificates docker.io jq openssh-client
|
|
|
|
COPY docker/docker-init.sh init.sh
|
|
|
|
RUN CLI_CMDS=$(jq -r '.commands | keys | map(.[0:index(":")]) | unique | join("\\ ")' < oclif.manifest.json); \
|
|
sed -ie "s/CLI_CMDS=\"help\"/CLI_CMDS=\"help\\ ${CLI_CMDS}\"/" init.sh && \
|
|
chmod +x init.sh
|
|
|
|
ENTRYPOINT [ "/usr/src/app/init.sh" ]
|
|
|
|
CMD [ "help" ]
|
|
|
|
ENV SSH_AUTH_SOCK "/ssh-agent"
|