Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate a Generic Container? #279

Closed
vsoch opened this issue Nov 11, 2022 · 5 comments
Closed

Generate a Generic Container? #279

vsoch opened this issue Nov 11, 2022 · 5 comments
Labels
feature New feature or request good first issue Good for newcomers

Comments

@vsoch
Copy link

vsoch commented Nov 11, 2022

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
Copy link
Collaborator

LucilleH commented Nov 11, 2022

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

@vsoch
Copy link
Author

vsoch commented Nov 11, 2022

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
Copy link
Contributor

Lagoja commented Nov 11, 2022

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

@Lagoja Lagoja added feature New feature or request good first issue Good for newcomers labels Nov 11, 2022
@vsoch
Copy link
Author

vsoch commented Nov 12, 2022

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Development

No branches or pull requests

3 participants