๐ป Developer | BMW Group
๐จโ๐ B. Sc. Informatics (TUM)
Check out my repositories:
lerna-dockerize is a package, that generates a dockerfile for lerna projects.
Home Page: https://github.com/rudxde/lerna-dockerize
License: Apache License 2.0
Dear lerna dockerize users,
I regret to inform you that the "lerna-dockerize" GitHub repository will no longer be actively maintained. As the sole maintainer, I have made the difficult decision to step back from further development and support for this project due to time constraints.
Lerna-Dockerize has been a valuable open source resource for simplifying the Dockerization process for Lerna-based projects.
While the repository will remain publicly accessible on GitHub, i will not be actively responding to issues, reviewing pull requests, or releasing new updates. However, i encourage the community to continue using and building upon the existing codebase.
If you are passionate about this project and wish to take on the role of maintainer, please feel free to fork the repository and continue its development independently. I welcome any community-driven efforts to keep the project alive and address issues that may arise in the future.
I would like to express my heartfelt appreciation to everyone who has submitted bug reports, and provided feedback on Lerna-Dockerize. Your support has contributed to its growth and usefulness.
Thank you for your understanding and for being a part of the open source community.
Best regards,
rudx,
Former Maintainer of Lerna-Dockerize
do you have a working example repo ?
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
I am having this issue when using the library, does anyone knows what I am doing wrong?
Building server
[+] Building 70.8s (18/20)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 35B 0.0s
=> [internal] load metadata for docker.io/library/amazonlinux:latest 1.1s
=> [internal] load metadata for docker.io/library/node:14 1.1s
=> [server-development 1/10] FROM docker.io/library/amazonlinux@sha256:05c170879b6dec01ee51dd380d4d63cfb9ba59e738a03531c7ab5923515af3b4 0.0s
=> [base 1/4] FROM docker.io/library/node:14@sha256:ab6c8cd32006f8a4c1c795e55ddfbc7f54f5a3fb7318506ecb355cab8f5e7182 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 213B 0.0s
=> CACHED [base 2/4] COPY ./package.json ./ 0.0s
=> CACHED [base 3/4] RUN npm install 0.0s
=> CACHED [base 4/4] COPY ./lerna.json ./ 0.0s
=> CACHED [server-development 2/10] WORKDIR /app/apps/server 0.0s
=> CACHED [server-development 3/10] RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash # for node version 14.x 0.0s
=> CACHED [server-development 4/10] RUN yum -y install nodejs 0.0s
=> CACHED [server-development 5/10] RUN yum -y install procps 0.0s
=> CACHED [server-development 6/10] RUN yum -y install git 0.0s
=> CACHED [server-development 7/10] COPY apps/server/package*.json ./ 0.0s
=> CACHED [server-development 8/10] WORKDIR /app/ 0.0s
=> ERROR [server-development 9/10] RUN npx lerna bootstrap --scope=server --includeDependencies 69.4s
------
> [server-development 9/10] RUN npx lerna bootstrap --scope=server --includeDependencies:
#18 68.45 npx: installed 673 in 68.104s
#18 68.61 lerna notice cli v4.0.0
#18 68.61 lerna ERR! ENOPKG `package.json` does not exist, have you run `lerna init`?
------
executor failed running [/bin/sh -c npx lerna bootstrap --
docker-compose.yml
services:
server:
container_name: nest_snuper
restart: always
env_file: .env
build:
context: .
dockerfile: Dockerfile
ports:
- ${BACKEND_PORT}:${BACKEND_PORT}
- 9229:9229
command: npm run start:server
Dockerfile.base
FROM node:14 as base
COPY ./package.json ./
RUN npm i
COPY ./lerna.json ./
./apps/server/Dockerfile
FROM amazonlinux as development
# Install npm
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash # for node version 14.x
RUN yum -y install nodejs
RUN yum -y install procps
RUN yum -y install git
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
lerna.json
{
"packages": [
"apps/**"
],
"tagVersionPrefix": "v",
"version": "2.0.0",
"command": {
"version": {
"allowBranch": "main",
"message": "chore(release): publish %s",
"exact": true,
"createRelease": "github",
"conventionalCommits": true
}
},
"lerna-dockerize": {
"logLevel": "error"
}
}
Dockerfile (generated)
FROM node:14 as base
COPY ./package.json ./
RUN npm install
COPY ./lerna.json ./
# Package server
FROM amazonlinux as server-development
WORKDIR /app/apps/server
# Install npm
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash # for node version 14.x
RUN yum -y install nodejs
RUN yum -y install procps
RUN yum -y install git
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY apps/server/package*.json ./
WORKDIR /app/
RUN npx lerna bootstrap --scope=server --includeDependencies
WORKDIR /app/apps/server
# final stage
FROM base
COPY --from=server-development /app/apps/server /app/apps/server
Describe the bug
Docker has a specific way to handle globally defined ARGs (ARGs above a FROM stage). Those globally defined ARGs can be reused in several FROM blocks. E.g. if you want to use ARGs which are defined in the Dockerfile.base
, you can reuse them in the package specific Dockerfiles via redefinition. But those definitions will be eleminated via lerna-dockerize.
Example Dockerfile.base
# This is the base stage, which prepares the project for further builds with lerna-dockerize.
# global arguments
ARG AWESOME_ARG=test
FROM node:12-slim
ARG AWESOME_ARG
RUN echo "varibale content: $AWESOME_ARG"
# do other stuff
To Reproduce
Steps to reproduce the behavior:
npm run lerna-dockerize
in you projectExpected behavior
The globally defined ARG should be taken into the output file.
Desktop (please complete the following information):
Additional context
See further information about ARG handling in docker documentation: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
Describe the bug
When using a custom dockerfile with run including multiple lines seperated by , only the first line is being added to the final dockerfile.
To Reproduce
For example using this dockerfile:
RUN yum -y install oracle-release-el7 oracle-nodejs-release-el7 && \
yum-config-manager --disable ol7_developer_EPEL && \
yum -y install oracle-instantclient19.3-basiclite nodejs && \
rm -rf /var/cache/yum
WORKDIR /myapp
ADD package.json /myapp/
ADD index.js /myapp/
RUN npm install
CMD exec node index.js
Expected behavior
Copying the entire RUN command
Desktop (please complete the following information):
Running on macos
the core lerna-dockerize
should be an all contained bundle, which contains all commands, which each are in a self-contained package under the @lerna/dockerize
scope, able to be installed separately.
The init
command of #269 will be in a separate module and the core functionality of generating a docker file should be extracted into a separate module called generate
.
Describe the bug
on Dockerfile.base, I specified RUN npm install -g @nestjs/cli
but this is line is being ignored on Dockerfile (generated)
To Reproduce
Steps to reproduce the behavior:
RUN npm install -g @nestjs/cli
npm run lerna-dockerize
RUN npm install -g @nestjs/cli
is omittedExpected behavior
It should add the line RUN npm install -g @nestjs/cli
to the generated Dockerfile
Screenshots
Desktop (please complete the following information):
Additional context
"lerna": "4.0.0",
"lerna-dockerize": "^0.8.2",
"npm": ">= 7.24.0",
I use the project from the examples: https://github.com/rudxde/lerna-dockerize/tree/master/packages/lerna-dockerize/test/integration/simple
Desktop:
To Reproduce
Running commands:
npm i && lerna bootstrap
npx lerna-dockerize init
npm run lerna-dockerize
docker build -t test .
I get an error:
Step 9/35 : RUN npx lerna bootstrap --scope=a --includeDependencies
---> Running in d48c7eb76185
lerna notice cli v5.1.8
lerna notice filter including "a"
lerna notice filter including dependencies
lerna info filter [ 'a' ]
lerna ERR! EFILTER No packages remain after filtering [ 'a' ]
The command '/bin/sh -c npx lerna bootstrap --scope=a --includeDependencies' returned a non-zero code: 1
The example does not contain node dependencies, but even if you add packages to dependencies, the situation will not change. Most likely I'm doing something wrong, tell me the reason for my failure.
Describe the bug
We are using distroless image as prod base image. When used with command npx lerna-dockerize --template-dockerfile-name Dockerfile.template
it generate Dockerfile with image value as FROM gcr as microservice-starter-1
To Reproduce
FROM base as build
COPY ./package.json ./
RUN npm ci
RUN --if-exists npm run build
RUN rm -rf node_modules
RUN --if-exists npm ci --only=production
FROM gcr.io/distroless/nodejs as prod
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/dist /usr/src/app/dist
COPY --from=build /usr/src/app/node_modules /usr/src/app/node_modules
COPY _proto /usr/_proto
ENV NODE_ENV production
# ENV GRPC_TRACE all
ENV GRPC_VERBOSITY WARNING
CMD ["dist/main.js"]
and simple base image.
npx lerna-dockerize --template-dockerfile-name Dockerfile.template
gcr
instead of full urlRUN npm ci --only=production
FROM gcr as microservice-starter-1
WORKDIR /app/microservices/_microservice_template
Describe the bug
If I use
RUN npm ci
in the base docker file, the generated docker file for the base image contains
RUN npm install
To Reproduce
Create a base dockerfile with
FROM node:16-alpine3.15 as base
WORKDIR /app
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci
Expected behavior
The generated docker file looks like
FROM node:16-alpine3.15 as base
WORKDIR /app
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci
Additional context
This is a problem because the install is overwriting the package-lock.json in side the docker image. Dosnt seem to happen in the template docker files only when used in the base. Im using V1.0.1
An build command should be added, which generates the dockerfile and starts the docker build automatically
To make the onboarding easier, lerna-dockerize should have an initialization script, which bootstraps a basic project setup
since the eol of node 12 will be at April 30 this year, it should be removed from the officially supported node versions of lerna-dockerize
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.