Generate a Generic Container?

This issue has been tracked since 2022-11-11.

hey devbox! I was wondering - why not have a fallback container generation for "all other cases" that are outside python, go, etc? For example, if we use nixos/nix and then the best way to install devbox, and then initiative a shell with a command that exits (to install stuffs) it would be fairly straight forward to have that be the fallback - here is an example: https://github.com/rse-ops/devbox/blob/main/bases/devbox/Dockerfile. And maybe I'd even do:

FROM nixos/nix
RUN nix-channel --update
RUN wget https://github.com/jetpack-io/devbox/releases/download/0.1.0/devbox_0.1.0_linux_amd64.tar.gz && \
    tar -xzvf devbox_0.1.0_linux_amd64.tar.gz && \
    chmod +x devbox && \
    mv devbox /usr/bin
ENV PATH=/usr/bin:$PATH
WORKDIR /code
COPY devbox.json devbox.json
RUN devbox shell -- echo "Installing packages"
ENTRYPOINT ["devbox"]
CMD ['shell']

So the default entrypoint is devbox shell right into the environment (not I haven't tried this, my container build above I default to a shell and then run devbox shell at my leisure!

LucilleH wrote this answer on 2022-11-11

Wow this is awesome!! In fact, instead of having this for the fallback scenario, it should be the default. cc @Lagoja

vsoch wrote this answer on 2022-11-11

Thanks! The one thing I'd like to improve upon is to figure out a way to have a one liner "install the latest devbox" that will work in the container. If we use something like the above, we'd minimally want to expose the version as an ARG I think. Let me know if I can help! I would absolutely love to be able to do like:

$ devbox build --name ghcr.io/rse-ops/openmpi-devbox

in a directory with a devbox.json and magically get a container with it!

Lagoja wrote this answer on 2022-11-11

I agree this should be the default behavior. I think having a way to get a generic container that has your packages + configuration installed could help a lot with portability. We'll add this as a task.

Thanks for suggesting @vsoch

vsoch wrote this answer on 2022-11-12

Heyo! I'm trying this out on a few computers (looking for issues) - right now on an older ubuntu and hit:

$ docker run -it ghcr.io/rse-ops/openmpi-devbox:clang-14 
bash-5.1# devbox shell
Installing nix packages. This may take a while...
Error: apply Nix derivation: running command /root/.nix-profile/bin/nix-env --profile /code/.devbox/nix/profile/default --install -f /code/.devbox/gen/development.nix: exit status 1 with command output: error: Operation not permitted

bash-5.1# 

Going to keep debugging but want to keep you in the loop!

Update: I couldn't reproduce this on a newer OS (ubuntu 20/22.04) so I think it might just be an old OS issue. I wouldn't worry if it was just for my old laptop this happened!

LucilleH wrote this answer on 2022-12-22

@vsoch this is done with the newest update 0.2.0. Use devbox generate dockerfile to generate a Dockerfile

More Details About Repo
Owner Name jetpack-io
Repo Name devbox
Full Name jetpack-io/devbox
Language Go
Created Date 2022-08-18
Updated Date 2023-03-31
Star Count 4960
Watcher Count 19
Fork Count 68
Issue Count 42

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date