Skip to content
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

Enable devcontainer development with dockerhub #1423

Merged
merged 5 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
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
101 changes: 1 addition & 100 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,103 +1,4 @@
FROM debian:bullseye as base
# This .devcontainer stuff is shamelessly copied from github.com/vzarytovskii/haskell-dev-env
ARG USERNAME=vscode
ARG GHC_VERSION=8.10.7
ARG STACK_VERSION=2.9.3
ARG STACK_RESOLVER=lts-18.28
ARG CABAL_VERSION=3.6.2.0
ARG HLS_VERSION=1.9.1.0
ARG LLVM_VERSION=12

ENV USERNAME=${USERNAME} \
USER_UID=1000 \
USER_GID=1000 \
DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF8 \
GHC_VERSION=${GHC_VERSION} \
STACK_RESOLVER=${STACK_RESOLVER} \
STACK_VERSION=${STACK_VERSION} \
CABAL_VERSION=${CABAL_VERSION} \
HLS_VERSION=${HLS_VERSION} \
LLVM_VERSION=${LLVM_VERSION}

RUN ulimit -n 8192

RUN export LANG=C.UTF8
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils bash build-essential ca-certificates curl gcc git gnupg libffi-dev libffi7 libgmp-dev libgmp-dev libgmp10 libicu-dev libncurses-dev libncurses5 libnuma1 libnuma-dev libtinfo5 lsb-release make procps software-properties-common sudo wget xz-utils z3 zlib1g-dev

RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && chmod +x /tmp/llvm.sh && /tmp/llvm.sh ${LLVM_VERSION} && rm /tmp/llvm.sh

RUN groupadd --gid $USER_GID $USERNAME && \
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

USER ${USER_UID}:${USER_GID}
WORKDIR /home/${USERNAME}
ENV PATH="/home/${USERNAME}/.local/bin:/home/${USERNAME}/.cabal/bin:/home/${USERNAME}/.ghcup/bin:$PATH"

RUN echo "export PATH=$PATH" >> /home/$USERNAME/.profile

ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=yes \
BOOTSTRAP_HASKELL_NO_UPGRADE=yes

FROM base as tooling

RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

# Set the GHC version.
RUN ghcup install ghc ${GHC_VERSION} && ghcup set ghc ${GHC_VERSION}

# Install cabal-iinstall
RUN ghcup install cabal ${CABAL_VERSION} && ghcup set cabal ${CABAL_VERSION}

# Update Cabal.
RUN cabal update && cabal new-install cabal-install

# Configure cabal
RUN cabal user-config update -f && \
sed -i 's/-- ghc-options:/ghc-options: -haddock/g' ~/.cabal/config

# Install stack
RUN ghcup install stack ${STACK_VERSION} && ghcup set stack ${STACK_VERSION}

# Set system-ghc, install-ghc and resolver for stack.
RUN ((stack ghc -- --version 2>/dev/null) || true) && \
# Set global defaults for stack.
stack config --system-ghc set system-ghc true --global && \
stack config --system-ghc set install-ghc false --global && \
stack config --system-ghc set resolver $STACK_RESOLVER

# Temporary required, because http2-4.0.0 is broken, and used to build haddock. See https://github.com/kazu-yamamoto/http2/issues/42
RUN stack install http2-3.0.3

# Set global custom defaults for stack.
RUN printf "ghc-options:\n \"\$everything\": -haddock\n" >> /home/${USERNAME}/.stack/config.yaml

# Install hls
RUN ghcup install hls ${HLS_VERSION} && ghcup set hls ${HLS_VERSION}

FROM tooling as packages

# Install global packages.
# Versions are pinned, since we don't want to accidentally break anything (by always installing latest).
RUN cabal install -v haskell-dap-0.0.15.0
RUN cabal install -v ghci-dap-0.0.19.0
RUN cabal install -v haskell-debug-adapter-0.0.37.0
RUN cabal install -v hlint-3.2.7
RUN cabal install -v apply-refact-0.9.3.0
RUN cabal install -v retrie-1.1.0.0
RUN cabal install -v stylish-haskell-0.13.0.0
# RUN cabal install -v hoogle-5.0.18.3
RUN cabal install -v ormolu-0.1.3.1
RUN cabal install -v liquidhaskell-0.8.10.2

# Generate hoogle db
# RUN hoogle generate && stack hoogle

# Set up the dependencies for Ampersand
# RUN cd /workspaces/Ampersand && stack build --dependencies-only .
FROM ampersandtarski/ampersand-devcontainer:latest

ENV DEBIAN_FRONTEND=dialog

Expand Down
105 changes: 105 additions & 0 deletions .devcontainer/DockerfileUpstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
FROM debian:bullseye as base
# This .devcontainer stuff is shamelessly copied from github.com/vzarytovskii/haskell-dev-env
ARG USERNAME=vscode
ARG GHC_VERSION=8.10.7
ARG STACK_VERSION=2.9.3
ARG STACK_RESOLVER=lts-18.28
ARG CABAL_VERSION=3.6.2.0
ARG HLS_VERSION=2.0.0.1
ARG LLVM_VERSION=16

ENV USERNAME=${USERNAME} \
USER_UID=1000 \
USER_GID=1000 \
DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF8

RUN ulimit -n 8192

RUN export LANG=C.UTF8
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils bash build-essential ca-certificates curl gcc git gnupg libffi-dev libffi7 libgmp-dev libgmp-dev libgmp10 libicu-dev libncurses-dev libncurses5 libnuma1 libnuma-dev libtinfo5 lsb-release make procps software-properties-common sudo wget xz-utils z3 zlib1g-dev

RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && chmod +x /tmp/llvm.sh && /tmp/llvm.sh ${LLVM_VERSION} && rm /tmp/llvm.sh

RUN groupadd --gid $USER_GID $USERNAME && \
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

USER ${USER_UID}:${USER_GID}
WORKDIR /home/${USERNAME}
ENV PATH="/home/${USERNAME}/.local/bin:/home/${USERNAME}/.cabal/bin:/home/${USERNAME}/.ghcup/bin:$PATH"

RUN echo "export PATH=$PATH" >> /home/${USERNAME}/.profile

ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=yes \
BOOTSTRAP_HASKELL_NO_UPGRADE=yes

FROM base as tooling

ENV GHC_VERSION=${GHC_VERSION} \
CABAL_VERSION=${CABAL_VERSION} \
STACK_VERSION=${STACK_VERSION} \
STACK_RESOLVER=${STACK_RESOLVER}

RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

# Set the GHC version.
RUN ghcup install ghc ${GHC_VERSION} && ghcup set ghc ${GHC_VERSION}

# Install cabal-iinstall
RUN ghcup install cabal ${CABAL_VERSION} && ghcup set cabal ${CABAL_VERSION}

# Update Cabal.
RUN cabal update && cabal new-install cabal-install

# Configure cabal
RUN cabal user-config update -f && \
sed -i 's/-- ghc-options:/ghc-options: -haddock/g' ~/.cabal/config

# Install stack
RUN ghcup install stack ${STACK_VERSION} && ghcup set stack ${STACK_VERSION}

# Set system-ghc, install-ghc and resolver for stack.
RUN ((stack ghc -- --version 2>/dev/null) || true) && \
# Set global defaults for stack.
stack config --system-ghc set system-ghc true --global && \
stack config --system-ghc set install-ghc false --global && \
stack config --system-ghc set resolver $STACK_RESOLVER

# Temporary required, because http2-4.0.0 is broken, and used to build haddock. See https://github.com/kazu-yamamoto/http2/issues/42
# RUN stack install http2-3.0.3

# Set global custom defaults for stack.
RUN printf "ghc-options:\n \"\$everything\": -haddock\n" >> ~/.stack/config.yaml

ENV HLS_VERSION=${HLS_VERSION}

# Install hls
RUN ghcup install hls ${HLS_VERSION} && ghcup set hls ${HLS_VERSION}

FROM tooling as packages

# Install global packages.
# Versions are pinned, since we don't want to accidentally break anything (by always installing latest).
# RUN cabal install -v haskell-dap-0.0.15.0
# RUN cabal install -v ghci-dap-0.0.19.0
# RUN cabal install -v haskell-debug-adapter-0.0.37.0
# RUN cabal install -v hlint-3.2.7
# RUN cabal install -v apply-refact-0.9.3.0
# RUN cabal install -v retrie-1.1.0.0
# RUN cabal install -v stylish-haskell-0.13.0.0
# # RUN cabal install -v hoogle-5.0.18.3
RUN cabal install -v ormolu-0.1.3.1
# RUN cabal install -v liquidhaskell-0.8.10.2

# Generate hoogle db
# RUN hoogle generate && stack hoogle

# Set up the dependencies for Ampersand
# RUN cd /workspaces/Ampersand && stack build --dependencies-only .

ENV DEBIAN_FRONTEND=dialog

ENTRYPOINT ["/bin/bash"]
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"remoteUser": "vscode",
"runArgs": [],
"build": {
"args": {
"args": { // These contain the values of the arguments that the Docker file takes.
"USERNAME": "vscode",
"GHC_VERSION": "8.10.7",
"STACK_VERSION": "2.9.3",
"STACK_RESOLVER": "lts-18.28",
"CABAL_VERSION": "3.6.2.0",
"HLS_VERSION": "1.9.1.0",
"HLS_VERSION": "2.0.0.1",
"LLVM_VERSION": "12"
},
"context": "..",
"dockerfile": "Dockerfile"
"dockerfile": "DockerfileUpstream"
},
"customizations": {
"vscode": {
Expand Down
5 changes: 4 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

## Unreleased changes

- Added easier development through Docker image at dockerhub: [ampersandtarski/ampersand-devcontainer](https://hub.docker.com/repository/docker/ampersandtarski/ampersand-devcontainer/general)

## v4.7.6 (26 february 2023)

## v4.7.5 (25 february 2023)
* [Issue #1381](https://github.com/AmpersandTarski/Ampersand/issues/1381) Generate prototype with Angular frontend (alpha version)

- [Issue #1381](https://github.com/AmpersandTarski/Ampersand/issues/1381) Generate prototype with Angular frontend (alpha version)

## v4.7.4 (20 february 2023)

Expand Down
7 changes: 6 additions & 1 deletion ampersand.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ extra-source-files:
outputTemplates/default.xwiki
outputTemplates/default.zimwiki
outputTemplates/README.md
testing/performance/Issue1409/Issue1409.xlsx
testing/performance/Issue1409/Issue1409A.adl
testing/performance/Issue1409/Issue1409B.adl
testing/README.md
testing/Sentinel/README.md
testing/Sentinel/Tests/NoSentinel/Conjuncts.adl
Expand Down Expand Up @@ -119,10 +122,11 @@ extra-source-files:
testing/Sentinel/Tests/ShouldSucceed/OnlyValidation/ViewAnnotationCheck.adl
testing/Sentinel/Tests/ShouldSucceed/testinfo.yaml
testing/StillUnsupported/Bug335_Kl0Kl1.adl
testing/StillUnsupported/Issue1397-1.adl
testing/StillUnsupported/Issue1397.adl
testing/StillUnsupported/Issue166.adl
testing/StillUnsupported/Issue166_2.adl
testing/Travis/README.md
testing/Travis/testcases/Bugs/Current/Other/testinfo.yaml
testing/Travis/testcases/Bugs/Current/SQL/ARM20-Test8.adl
testing/Travis/testcases/Bugs/Current/SQL/testinfo.yaml
testing/Travis/testcases/Bugs/Current/SQLFail/Bug302_IgnoredV.adl
Expand Down Expand Up @@ -292,6 +296,7 @@ extra-source-files:
testing/Travis/testcases/prototype/shouldSucceed/Issue1026.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1261.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1281.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1413.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue142.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue142.xlsx
testing/Travis/testcases/prototype/shouldSucceed/Issue142TooGeneric.adl
Expand Down