Skip to content

Commit

Permalink
Have explicit version ARGS in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Jun 17, 2024
1 parent 43597b1 commit e8ce0a7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 23 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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)"
Expand Down
2 changes: 2 additions & 0 deletions changelog.d/557
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
synopsis: Have explicit version ARGS in docker for tools
prs: #557
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
server:
image: ghcr.io/flora-pm/flora-server:latest
Expand Down

0 comments on commit e8ce0a7

Please sign in to comment.