Skip to content

[generate] Updated dockerfile template to use devbox image #1432

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

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions internal/impl/generate/tmpl/devcontainerDockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
FROM debian:stable-slim

# Step 1: Installing dependencies
RUN apt-get update
RUN apt-get -y install bash binutils git{{if .IsDevcontainer}} gnupg2{{- end}} xz-utils wget sudo

{{- if not .RootUser }}

# Step 1.5: Setting up devbox user
ENV DEVBOX_USER=devbox
RUN adduser $DEVBOX_USER
RUN usermod -aG sudo $DEVBOX_USER
RUN echo "devbox ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$DEVBOX_USER
USER $DEVBOX_USER
{{- end}}

# Step 2: Installing Nix
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --{{if not .RootUser}}no-{{- end}}daemon
RUN . ~/.nix-profile/etc/profile.d/nix.sh
{{ if .RootUser }}
ENV PATH="/root/.nix-profile/bin:$PATH"
{{ else }}
ENV PATH="/home/${DEVBOX_USER}/.nix-profile/bin:$PATH"
{{- end}}

# Step 3: Installing devbox
RUN wget --quiet --output-document=/dev/stdout https://get.jetpack.io/devbox | bash -s -- -f
{{- if not .RootUser }}
RUN chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /usr/local/bin/devbox
{{- if .RootUser }}FROM jetpackio/devbox-root-user:latest
{{- else }}FROM jetpackio/devbox:latest
{{- end}}

# Step 4: Installing your devbox project
# Installing your devbox project
WORKDIR /code
COPY devbox.json devbox.json
COPY devbox.lock devbox.lock
Expand Down