From 931a27424e8e431278bd232e62379e94837668f1 Mon Sep 17 00:00:00 2001 From: Aminur Rahman Date: Mon, 3 Jun 2024 14:29:20 +0000 Subject: [PATCH 1/7] Persist $HOME contents and move init to dockerfile --- .gitpod.Dockerfile | 31 +++++++++++++++++++------------ .gitpod.yml | 19 +++---------------- main.code-workspace | 12 ++++++++++++ 3 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 main.code-workspace diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index ab6b6ea..9dc12d7 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -1,22 +1,29 @@ -FROM gitpod/workspace-full:latest +# Image source code: https://github.com/axonasif/workspace-images/tree/tmp +# Also see https://github.com/gitpod-io/workspace-images/issues/1071 +FROM axonasif/workspace-base@sha256:8c057b1d13bdfe8c279c68aef8242d32110c8d5310f9a393f9c0417bc61367d9 USER gitpod # or git will keep prompting RUN git config --global pull.ff only -# ~/.stack, ~/.ghcup will be lost across Gitpod workspace restarts, -# use /workspace/ so it is persisted as part of prebuilt workspace -ENV STACK_ROOT=/workspace/.stack -ENV GHCUP_INSTALL_BASE_PREFIX=/workspace +# install ghcup, then stack and hls via it +RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh + +# Persist ~ due to the requirements of this project +RUN echo 'create-overlay $HOME' > "$HOME/.runonce/1-home_persist" # Add ghcup to path -ENV PATH=/workspace/bin:/workspace/.ghcup/bin:${PATH} +ENV PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH" +RUN ghcup install stack && ghcup install hls -# create toolhome -RUN mkdir -p /workspace/bin +# Moved commands from .gitpod.yml:init +RUN sudo sh -c 'curl -o /usr/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm && chmod +x /usr/bin/epm' -# install ghcup, then stack and hls via it -RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh -RUN ghcup install stack -RUN ghcup install hls +RUN cd $HOME && mkdir -p edh && cd edh \ + && epm init \ + -B https://github.com/e-wrks edh \ + -B http://github.com/complyue nedh els sedh eas hasdim haskit + # && cd edh-universe \ + # && stack update \ + # && stack install diff --git a/.gitpod.yml b/.gitpod.yml index 4342b56..3c54742 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,30 +1,17 @@ image: file: .gitpod.Dockerfile +workspaceLocation: tour/main.code-workspace # Relative to /workspace dir + ports: - port: 1024-6000 onOpen: ignore tasks: - name: Build Đ Tooling - init: | - # /workspace/bin should have been created per Dockerfile, and added to $PATH - curl -o /workspace/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm - chmod a+x /workspace/bin/epm - # prepare /workspace as an epm home - cd /workspace - epm init \ - -B https://github.com/e-wrks \ - edh \ - -B http://github.com/complyue \ - nedh els sedh eas hasdim haskit - cd /workspace/edh-universe - # build & install executables from Edh packages - stack update - stack install command: | # update packages in root epm home - cd /workspace/edh-universe + cd $HOME/edh/edh-universe epm up epm i epm x gen-hie > hie.yaml diff --git a/main.code-workspace b/main.code-workspace new file mode 100644 index 0000000..bcb9b2d --- /dev/null +++ b/main.code-workspace @@ -0,0 +1,12 @@ +{ + // All paths are relative to your main repo + // The additional repos are cloned inside /workspace dir + "folders": [ + { + "path": "." // Main repo that you will open in Gitpod (e.g. frontend) + }, + { + "path": "/home/gitpod/edh" // Additional repo + } + ] +} \ No newline at end of file From d801b7e850ee4d32dd9fe5499e79ba311c7510ca Mon Sep 17 00:00:00 2001 From: Compl Yue Date: Tue, 4 Jun 2024 14:04:25 +0000 Subject: [PATCH 2/7] epm home needs to live at /workspace --- .gitpod.Dockerfile | 26 +++++++++++--------------- .gitpod.yml | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 9dc12d7..47115e9 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -4,26 +4,22 @@ FROM axonasif/workspace-base@sha256:8c057b1d13bdfe8c279c68aef8242d32110c8d5310f9 USER gitpod +# Persist ~ due to the requirements of this project +RUN echo 'create-overlay $HOME' > "$HOME/.runonce/1-home_persist" + # or git will keep prompting RUN git config --global pull.ff only # install ghcup, then stack and hls via it RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh - -# Persist ~ due to the requirements of this project -RUN echo 'create-overlay $HOME' > "$HOME/.runonce/1-home_persist" - -# Add ghcup to path -ENV PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH" RUN ghcup install stack && ghcup install hls +# populate stack's cache, this takes minutes & GBs +RUN stack update -# Moved commands from .gitpod.yml:init -RUN sudo sh -c 'curl -o /usr/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm && chmod +x /usr/bin/epm' +# add /workspace/bin and ghcup to PATH +ENV PATH="/workspace/bin:$HOME/.ghcup/bin:$PATH" -RUN cd $HOME && mkdir -p edh && cd edh \ - && epm init \ - -B https://github.com/e-wrks edh \ - -B http://github.com/complyue nedh els sedh eas hasdim haskit - # && cd edh-universe \ - # && stack update \ - # && stack install +# install latest epm +RUN mkdir -p $HOME/.local/bin; \ + curl -o $HOME/.local/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm && \ + chmod +x $HOME/.local/bin/epm diff --git a/.gitpod.yml b/.gitpod.yml index 3c54742..24efd00 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,14 +9,25 @@ ports: tasks: - name: Build Đ Tooling + init: | + # prepare /workspace as an epm home + cd /workspace + epm init \ + -B https://github.com/e-wrks \ + edh \ + -B http://github.com/complyue \ + nedh els sedh eas hasdim haskit + cd /workspace/edh-universe + # build & install executables from Edh packages, + # this takes minutes & GBs + stack update + stack install command: | # update packages in root epm home - cd $HOME/edh/edh-universe + cd /workspace/edh-universe epm up epm i - epm x gen-hie > hie.yaml # update executables from Edh packages - stack update stack install vscode: From 8cc01ded210c50455d013361939b5372e9071c71 Mon Sep 17 00:00:00 2001 From: ComplYue Date: Tue, 4 Jun 2024 22:15:50 +0800 Subject: [PATCH 3/7] fixup --- .gitpod.Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 47115e9..1fd1000 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -12,7 +12,9 @@ RUN git config --global pull.ff only # install ghcup, then stack and hls via it RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh -RUN ghcup install stack && ghcup install hls +RUN ghcup update && \ + ghcup install stack && \ + ghcup install hls # populate stack's cache, this takes minutes & GBs RUN stack update From dfd630b682a2111ea5d724b128e4f3a87d8feb39 Mon Sep 17 00:00:00 2001 From: ComplYue Date: Tue, 4 Jun 2024 22:23:23 +0800 Subject: [PATCH 4/7] fixup ghcup install --- .gitpod.Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 1fd1000..0b22dde 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -10,17 +10,16 @@ RUN echo 'create-overlay $HOME' > "$HOME/.runonce/1-home_persist" # or git will keep prompting RUN git config --global pull.ff only +# add /workspace/bin and ghcup to PATH +ENV PATH="/workspace/bin:$HOME/.ghcup/bin:$PATH" + # install ghcup, then stack and hls via it RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh -RUN ghcup update && \ - ghcup install stack && \ +RUN ghcup install stack && \ ghcup install hls # populate stack's cache, this takes minutes & GBs RUN stack update -# add /workspace/bin and ghcup to PATH -ENV PATH="/workspace/bin:$HOME/.ghcup/bin:$PATH" - # install latest epm RUN mkdir -p $HOME/.local/bin; \ curl -o $HOME/.local/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm && \ From 9feba37ebfb2b078a6b976d933608617a767e516 Mon Sep 17 00:00:00 2001 From: Compl Yue Date: Tue, 4 Jun 2024 15:12:23 +0000 Subject: [PATCH 5/7] fixup .code-workspace folder --- main.code-workspace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.code-workspace b/main.code-workspace index bcb9b2d..41b64b6 100644 --- a/main.code-workspace +++ b/main.code-workspace @@ -6,7 +6,7 @@ "path": "." // Main repo that you will open in Gitpod (e.g. frontend) }, { - "path": "/home/gitpod/edh" // Additional repo + "path": "/workspace/edh-universe" // Additional repo } ] } \ No newline at end of file From 88555f62bb0bd250448a3d898223ae284dcf4513 Mon Sep 17 00:00:00 2001 From: ComplYue Date: Tue, 4 Jun 2024 23:19:21 +0800 Subject: [PATCH 6/7] trigger gitpod rebuild --- .rebuild-gitpod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rebuild-gitpod b/.rebuild-gitpod index 6cafedb..f2463ad 100644 --- a/.rebuild-gitpod +++ b/.rebuild-gitpod @@ -1,2 +1,2 @@ Increase this number to trigger Gitpod rebuild: -1 +2 From 79a3a81213d6bfbbc6798f6a4e8811af30ceb9b2 Mon Sep 17 00:00:00 2001 From: Compl Yue Date: Tue, 4 Jun 2024 15:23:31 +0000 Subject: [PATCH 7/7] update epm on init task --- .gitpod.yml | 2 ++ .rebuild-gitpod | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 .rebuild-gitpod diff --git a/.gitpod.yml b/.gitpod.yml index 24efd00..68fdf93 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,6 +10,8 @@ ports: tasks: - name: Build Đ Tooling init: | + # update epm to latest version + curl -o $HOME/.local/bin/epm -L https://github.com/e-wrks/epm/raw/latest/epm # prepare /workspace as an epm home cd /workspace epm init \ diff --git a/.rebuild-gitpod b/.rebuild-gitpod deleted file mode 100644 index f2463ad..0000000 --- a/.rebuild-gitpod +++ /dev/null @@ -1,2 +0,0 @@ -Increase this number to trigger Gitpod rebuild: -2