diff --git a/.gitignore b/.gitignore index 98a2b7de2..30756b640 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ src/Handler/Assist.bak src/Handler/Course.SnapCustom.hs *.orig /instance +backend/instance .stack-work-* .stack-work.lock .directory diff --git a/Makefile b/Makefile index fbc403b6b..db8df3c86 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ export SHELL=bash export CLEAN_DEPENDENCIES ?= false export CLEAN_IMAGES ?= false +export ENTRYPOINT ?= bash +export SRC + .PHONY: help # HELP: print out this help message help: @@ -77,11 +80,13 @@ start-%: docker compose up -d --build $* .PHONY: shell-% +# HELP(shell-$SERVICE): launch a (bash) shell inside a given service shell-%: - docker compose run --build --no-deps $* bash + docker compose run --build --no-deps --entrypoint="$(ENTRYPOINT)" $* .PHONY: ghci -ghci: - docker compose run --build --no-deps backend stack ghci $(SRC) +# HELP: launch ghci instance. Use in combination with SRC to specify the modules to be loaded by ghci: make ghci SRC=src/SomeModule.hs +ghci: ENTRYPOINT=stack ghci $(SRC) +ghci: shell-backend ; .PHONY: stop # HELP: stop all services @@ -104,6 +109,10 @@ status: # HELP: print an overview of the ressource usage of the currently running services top: docker compose stats +.PHONY: list-projects +# HELP: list all currently running projects on this machine +list-projects: + docker compose ls .PHONY: log-% # HELP(log-$SERVICE): follow the output of a given service. Service must be running. diff --git a/backend/Dockerfile b/backend/Dockerfile index d6ccf8b2d..7b8069f2f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,20 +1,20 @@ -ARG FROM_IMG=docker.io/library/haskell -ARG FROM_TAG=8.10.4 +ARG FROM_IMG=docker.io/library/debian +ARG FROM_TAG=12.5 FROM ${FROM_IMG}:${FROM_TAG} ENV LANG=de_DE.UTF-8 +# basic dependencies +RUN apt-get -y update && apt-get -y install git +RUN apt-get -y update && apt-get -y install haskell-stack +RUN apt-get -y update && apt-get -y install llvm +RUN apt-get -y update && apt-get install -y --no-install-recommends locales locales-all + # compile-time dependencies -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ---mount=type=cache,target=/var/lib/apt,sharing=locked \ -apt-get -y update && apt-get install -y libpq-dev libsodium-dev -# RUN apt-get -y update && apt-get -y install llvm -# RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config -# RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ---mount=type=cache,target=/var/lib/apt,sharing=locked \ -apt-get -y update && apt-get install -y --no-install-recommends locales locales-all +RUN apt-get -y update && apt-get install -y libpq-dev libsodium-dev +RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config +RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # run-time dependencies for uniworx binary RUN apt-get -y update && apt-get -y install fonts-roboto @@ -33,4 +33,8 @@ ENV PROJECT_DIR=${PROJECT_DIR} # RUN mkdir -p "${PROJECT_DIR}"; chmod -R 777 "${PROJECT_DIR}" WORKDIR ${PROJECT_DIR} ENV HOME=${PROJECT_DIR} -ENV STACK_ROOT="${PROJECT_DIR}/.stack" \ No newline at end of file +ENV STACK_ROOT="${PROJECT_DIR}/.stack" + +ENV STACK_SRC="" +ENV STACK_ENTRY="ghci ${STACK_SRC}" +ENTRYPOINT stack ${STACK_ENTRY} \ No newline at end of file diff --git a/backend/Makefile b/backend/Makefile index 5915ecea4..b294f317f 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -9,7 +9,6 @@ endif .PHONY: dependencies dependencies: - chown -R `id -un`:`id -gn` "$(PROJECT_DIR)"; \ stack install hpack; stack install yesod-bin; \ stack build -j2 --only-dependencies diff --git a/backend/stack.yaml b/backend/stack.yaml index aaba0bfd0..1813ffb76 100644 --- a/backend/stack.yaml +++ b/backend/stack.yaml @@ -9,6 +9,7 @@ flags: rebuild-ghc-options: true #ghc-options: # "$everything": -fno-prof-auto +allow-different-user: true local-bin-path: ./bin