Skip to content

Commit

Permalink
Merge branch 'devWithDockerHub'
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoosten committed Jun 30, 2023
2 parents f562547 + 859098f commit 0d3790c
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 104 deletions.
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 @@ -3,10 +3,13 @@
## Unreleased changes
* [Issue #1419] added a test, to be activated in the regression after resolving #1419.
* [Issue #1420] added a test, to be activated in the regression after resolving #1420.
- 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

0 comments on commit 0d3790c

Please sign in to comment.