How do I set PATH in init just like Dockerfile ENV?

Hi, I’m new to gitpod. I’m trying to build a Haskell environment.

With this Dockerfile, I think my environment works.

FROM gitpod/workspace-base

RUN echo "deb http://downloads.haskell.org/debian buster main" | sudo tee -a /etc/apt/sources.list \
    && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 \
    && sudo apt-get update && sudo apt-get install ghc-8.10.4 cabal-install-3.2 -y
ENV PATH /opt/ghc/bin:$PATH

But when I try to move the logic into init stage, I don’t know how to set the PATH

tasks:
  - init: |
      echo "deb http://downloads.haskell.org/debian buster main" | sudo tee -a /etc/apt/sources.list
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574
      sudo apt-get update && sudo apt-get install ghc-8.10.4 cabal-install-3.2 -y

      TODO: Equivalent to `ENV PATH /opt/ghc/bin:$PATH`?

I tried echo 'export PATH=/opt/ghc/bin:$PATH' >> ~/.bashrc, but VSC’s Haskell extension still says it can’t find the compiler.

Hi @imba-tjd! Welcome to the Gitpod community :orange_heart:

I would suggest that you leave your current configuration on your Dockerfile the way it is. Usually sudo apt-get is best left in the Dockerfile rather than the gitpod.yml file. Please see relevant documentation here and here

To set environment variables in gitpod.yml this documentation here may help and this community post