jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.83k stars 187 forks source link

Start of container with generated Dockerfile is super slow #2117

Open iptizer opened 1 month ago

iptizer commented 1 month ago

What problem are you trying to solve?

The Dockerfile generated by the command devbox generate dockerfile has a super slow startup.

The first invocation of devbox shell seems to do some initialization, even though all packages have already been installed. After the initial invocation it is really fast. But before that in my example it too >1 minute on the first run.

I use my devbox built docker container to debug stuff on a Kubernetes cluster and having 1 minute to wait for the container to initialize is not practical.

FROM jetpackio/devbox:latest

# Installing your devbox project
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock

RUN devbox run -- echo "Installed Packages."

CMD ["devbox", "shell"]

What solution would you like?

Either in documentation or as part of the generate command: Option to pre-initialize the shell.

I tried with devbox shell as part of the build process. But this seems strange as probably eveyone wants to have this pree-initialized?

https://github.com/iptizer/swiss/blob/master/Dockerfile#L12

Alternatives you've considered

No response