Skip to content

Generated Dockerfile fails build because of mkdir /code #1930

@s0rbus

Description

@s0rbus

What happened?

I ran devbox generate and tried to use the generated files in vscode to create a devcontainer. Build fails because the generated Dockerfile first runs WORKDIR /code then later attempts RUN mkdir /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code. The WORKDIR command creates /code so then mkdir /code fails.

I also tried this out by attempting to manually create a docker image using the generated Dockerfile - this fails for same reason.

I suggest the mkdir /code is removed OR WORKDIR /code is moved to later in the Dockerfile. When I removed mkdir /code then everything works as expected.

Steps to reproduce

  1. devbox generate devcontainer
  2. open folder in vscode which should build an image and run container

Command

generate

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.1/.schema/devbox.schema.json",
  "packages": [
    "python310@latest",
    "jq@latest"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.10.1

Nix version

2.21.0

What system does this bug occur on?

Linux (ARM64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions