← Back to issue list

Allow setting of a working directory for the resulting ROCK in rockcraft.yaml

View original Github issue

Metadata

Project
rockcraft
Number
#121
Type
issue
State
open
Author
gruyaume
Labels
Created
2022-10-12 19:16:13+00:00
Updated
2026-02-26 07:29:44+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

**Feature Request** Lots of software require the user to be in a given directory before the startup command can be called. As of Today, there is no way to set the working directory of a given rock, the default working directory being "/". This forces users to create an entrypoint (or cmd) that `cd's` in a given directory before calling the actual command). It would be great if a `working-directory` field was added to `rockcraft.yaml` that would set the working directory to the provided path. Here's an example of how the rockcraft.yaml could look: ```yaml name: magma-orc8r-nms-magmalte version: "1.6.0" base: ubuntu:18.04 summary: Magma Orchestrator NMS Magmalte description: Magma Orcestrator NMS Magmalte license: Apache-2.0 platforms: amd64: cmd: ["/bin/yarn", "run", "start:prod"] working-directory: "/usr/src/packages/magmalte/" ``` **Expected behaviour** - The `entrypoint` command is executed from the provided working-directory - At run time, if you `exec` a command in the container, it is executed from the directory provided in the `rockcraft.yaml` file. - Ideally: This working directory is available through environment variables inside of parts (ex. `$WORKING_DIRECTORY`).

Evaluation history

No evaluation history available.