From e8ce0a7bbdaeffeaf72180c6e8d630f64d24a05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Jun 2024 18:15:29 +0200 Subject: [PATCH] Have explicit version ARGS in docker --- .github/workflows/docker-image.yml | 2 +- .github/workflows/test-docker-image.yml | 2 +- Dockerfile | 38 +++++++++++++++---------- changelog.d/557 | 2 ++ docker-compose.yml | 1 - 5 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 changelog.d/557 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0f0eb1b5..f7dab565 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,7 +19,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build the hello-docker Docker image + - name: Build the Docker image run: | docker build . --tag ghcr.io/flora-pm/flora-server:latest docker run ghcr.io/flora-pm/flora-server:latest diff --git a/.github/workflows/test-docker-image.yml b/.github/workflows/test-docker-image.yml index a92eb35c..c74464d9 100644 --- a/.github/workflows/test-docker-image.yml +++ b/.github/workflows/test-docker-image.yml @@ -13,5 +13,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Build the hello-docker Docker image + - name: Build the Docker image run: make docker-build diff --git a/Dockerfile b/Dockerfile index 9191206a..1275d0b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,15 @@ FROM ubuntu@sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6 ARG GID=1000 ARG UID=1000 -ARG ghc_version=9.6.5 -ARG cabal_version=3.10.3.0 +ARG GHC_VERSION=9.6.5 +ARG CABAL_VERSION=3.10.3.0 +ARG FOURMOLU_VERSION=0.14.1.0 +ARG HLINT_VERSION=3.8 +ARG APPLY_REFACT_VERSION=0.14.0.0 +ARG CABAL_FMT_VERSION=0.1.12 +ARG GHCID_VERSION=0.8.9 +ARG GHC_TAGS_VERSION=1.8 +ARG POSTGRESQL_MIGRATION_VERSION=0.2.1.8 # generate a working directory USER "root" @@ -23,29 +30,29 @@ RUN chown -R $USER:$USER /home/$USER/.cabal WORKDIR /flora-server RUN apt update && \ - apt install -y build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 git libsodium-dev + apt install -y build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 git libsodium-dev pkg-config # install dependencies (pg_config, postgresql-client, yarn) ENV BOOTSTRAP_HASKELL_NONINTERACTIVE="YES" -ENV BOOTSTRAP_HASKELL_GHC_VERSION="$ghc_version" -ENV BOOTSTRAP_HASKELL_CABAL_VERSION="$cabal_version" ENV BOOTSTRAP_HASKELL_INSTALL_NO_STACK="YES" ENV BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK="YES" -ENV BOOTSTRAP_HASKELL_INSTALL_HLS="YES" +ENV PATH="$PATH:/home/$USER/.ghcup/bin" RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list RUN apt install -y nodejs libpq-dev mcpp wget zsh tmux postgresql-client RUN corepack enable -RUN chmod ugo+x /home/$USER/.cabal - USER ${USER} +RUN chmod ugo+x /home/$USER/.cabal RUN git config --global --add safe.directory "*" RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh +RUN ghcup install hls $HLS_VERSION \ + && ghcup install ghc $GHC_VERSION \ + && ghcup set ghc $GHC_VERSION \ + && ghcup install cabal $CABAL_VERSION USER ${USER} -ENV PATH="$PATH:/home/$USER/.ghcup/bin" # install soufflé USER "root" @@ -59,12 +66,13 @@ RUN echo $PATH # to run `cabal update` as separate step, as cabal doesn't delete # package versions) RUN cabal update -RUN cabal install -j postgresql-migration -RUN cabal install -j hlint apply-refact -RUN cabal install -j fourmolu-0.14.1.0 -RUN cabal install -j cabal-fmt -RUN cabal install -j ghcid -RUN cabal install -j ghc-tags +RUN cabal install -j postgresql-migration-$POSTGRESQL_MIGRATION_VERSION +RUN cabal install -j hlint-$HLINT_VERSION +RUN cabal install -j apply-refact-$APPLY_REFACT_VERSION +RUN cabal install -j fourmolu-$FOURMOLU_VERSION +RUN cabal install -j cabal-fmt-$CABAL_FMT_VERSION +RUN cabal install -j ghcid-$GHCID_VERSION +RUN cabal install -j ghc-tags-$GHC_TAGS_VERSION # configure the shell RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" diff --git a/changelog.d/557 b/changelog.d/557 new file mode 100644 index 00000000..6b5762ed --- /dev/null +++ b/changelog.d/557 @@ -0,0 +1,2 @@ +synopsis: Have explicit version ARGS in docker for tools +prs: #557 diff --git a/docker-compose.yml b/docker-compose.yml index 8a8bcb22..91230b31 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3" services: server: image: ghcr.io/flora-pm/flora-server:latest