Merged PR 18750: refactor haskell build container
This commit is contained in:
commit
89d2462974
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,6 +42,7 @@ src/Handler/Assist.bak
|
|||||||
src/Handler/Course.SnapCustom.hs
|
src/Handler/Course.SnapCustom.hs
|
||||||
*.orig
|
*.orig
|
||||||
/instance
|
/instance
|
||||||
|
backend/instance
|
||||||
.stack-work-*
|
.stack-work-*
|
||||||
.stack-work.lock
|
.stack-work.lock
|
||||||
.directory
|
.directory
|
||||||
|
|||||||
15
Makefile
15
Makefile
@ -3,6 +3,9 @@ export SHELL=bash
|
|||||||
export CLEAN_DEPENDENCIES ?= false
|
export CLEAN_DEPENDENCIES ?= false
|
||||||
export CLEAN_IMAGES ?= false
|
export CLEAN_IMAGES ?= false
|
||||||
|
|
||||||
|
export ENTRYPOINT ?= bash
|
||||||
|
export SRC
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
# HELP: print out this help message
|
# HELP: print out this help message
|
||||||
help:
|
help:
|
||||||
@ -77,11 +80,13 @@ start-%:
|
|||||||
docker compose up -d --build $*
|
docker compose up -d --build $*
|
||||||
|
|
||||||
.PHONY: shell-%
|
.PHONY: shell-%
|
||||||
|
# HELP(shell-$SERVICE): launch a (bash) shell inside a given service
|
||||||
shell-%:
|
shell-%:
|
||||||
docker compose run --build --no-deps $* bash
|
docker compose run --build --no-deps --entrypoint="$(ENTRYPOINT)" $*
|
||||||
.PHONY: ghci
|
.PHONY: ghci
|
||||||
ghci:
|
# HELP: launch ghci instance. Use in combination with SRC to specify the modules to be loaded by ghci: make ghci SRC=src/SomeModule.hs
|
||||||
docker compose run --build --no-deps backend stack ghci $(SRC)
|
ghci: ENTRYPOINT=stack ghci $(SRC)
|
||||||
|
ghci: shell-backend ;
|
||||||
|
|
||||||
.PHONY: stop
|
.PHONY: stop
|
||||||
# HELP: stop all services
|
# HELP: stop all services
|
||||||
@ -104,6 +109,10 @@ status:
|
|||||||
# HELP: print an overview of the ressource usage of the currently running services
|
# HELP: print an overview of the ressource usage of the currently running services
|
||||||
top:
|
top:
|
||||||
docker compose stats
|
docker compose stats
|
||||||
|
.PHONY: list-projects
|
||||||
|
# HELP: list all currently running projects on this machine
|
||||||
|
list-projects:
|
||||||
|
docker compose ls
|
||||||
|
|
||||||
.PHONY: log-%
|
.PHONY: log-%
|
||||||
# HELP(log-$SERVICE): follow the output of a given service. Service must be running.
|
# HELP(log-$SERVICE): follow the output of a given service. Service must be running.
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
ARG FROM_IMG=docker.io/library/haskell
|
ARG FROM_IMG=docker.io/library/debian
|
||||||
ARG FROM_TAG=8.10.4
|
ARG FROM_TAG=12.5
|
||||||
|
|
||||||
FROM ${FROM_IMG}:${FROM_TAG}
|
FROM ${FROM_IMG}:${FROM_TAG}
|
||||||
|
|
||||||
ENV LANG=de_DE.UTF-8
|
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
|
# compile-time dependencies
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
RUN apt-get -y update && apt-get install -y libpq-dev libsodium-dev
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config
|
||||||
apt-get -y update && apt-get install -y libpq-dev libsodium-dev
|
RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
||||||
# 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-time dependencies for uniworx binary
|
# run-time dependencies for uniworx binary
|
||||||
RUN apt-get -y update && apt-get -y install fonts-roboto
|
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}"
|
# RUN mkdir -p "${PROJECT_DIR}"; chmod -R 777 "${PROJECT_DIR}"
|
||||||
WORKDIR ${PROJECT_DIR}
|
WORKDIR ${PROJECT_DIR}
|
||||||
ENV HOME=${PROJECT_DIR}
|
ENV HOME=${PROJECT_DIR}
|
||||||
ENV STACK_ROOT="${PROJECT_DIR}/.stack"
|
ENV STACK_ROOT="${PROJECT_DIR}/.stack"
|
||||||
|
|
||||||
|
ENV STACK_SRC=""
|
||||||
|
ENV STACK_ENTRY="ghci ${STACK_SRC}"
|
||||||
|
ENTRYPOINT stack ${STACK_ENTRY}
|
||||||
@ -9,7 +9,6 @@ endif
|
|||||||
|
|
||||||
.PHONY: dependencies
|
.PHONY: dependencies
|
||||||
dependencies:
|
dependencies:
|
||||||
chown -R `id -un`:`id -gn` "$(PROJECT_DIR)"; \
|
|
||||||
stack install hpack; stack install yesod-bin; \
|
stack install hpack; stack install yesod-bin; \
|
||||||
stack build -j2 --only-dependencies
|
stack build -j2 --only-dependencies
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ flags:
|
|||||||
rebuild-ghc-options: true
|
rebuild-ghc-options: true
|
||||||
#ghc-options:
|
#ghc-options:
|
||||||
# "$everything": -fno-prof-auto
|
# "$everything": -fno-prof-auto
|
||||||
|
allow-different-user: true
|
||||||
|
|
||||||
local-bin-path: ./bin
|
local-bin-path: ./bin
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user