-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfilePyrethrum
54 lines (45 loc) · 1.86 KB
/
DockerfilePyrethrum
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Use the latest official Ubuntu image as a base
FROM theghostjw/haskell:latest
# use
# docker build -t "pyrethrum" .
# docker tag pyrethrum theghostjw/pyrethrum:latest
# docker push theghostjw/pyrethrum:latest
# vscode user created in haskell
# TODo: parameterise this amd args must run through all pipelines
ENV DEBIAN_FRONTEND=noninteractive \
USERNAME=vscode \
# modified from https://github.com/vzarytovskii/haskell-dev-env/blob/master/.devcontainer/Dockerfile
# this 1000 is aready taken by ubuntu
USER_UID=1001 \
USER_GID=1001
ARG REPO=https://github.com/theGhostJW/pyrethrum.git
ARG BRANCH=poc-lazy-exe-doc
# ensure switched user
USER ${USER_UID}:${USER_GID}
# Set the working directory
WORKDIR /home/vscode
# Sadly this has to all be in a single RUN command so REPO_DIR can be used
# Docker does not directly support storing command output in variables within a Dockerfile as you might in a shell script.
# The example combines commands using && to ensure they are executed in the same shell,
# allowing the use of the variable ${REPO_DIR} within the scope of that RUN command.
# calculate local repo dir
RUN REPO_DIR=$(basename -s .git "${REPO}") \
# clone into home (note single branch)
&& git clone --single-branch --branch ${BRANCH} ${REPO} \
# cd into source repo
&& cd "${REPO_DIR}" \
# build it all (go have coffee for an hour or more)
# libraries will be cached by cabal
# local modules => dist-newstyle
&& cabal build \
# local copy module build artifacts to home dir
# note this does not work cabal is too clever with its cach invalidation
# && cp -r ./dist-newstyle /home/vscode/dist-newstyle \
# CD out
&& cd .. \
# delete the repo
&& rm -rf "${REPO_DIR}"
# Expose a port if the application needs it
# EXPOSE 8080
# Specify the default command to run when the container starts
CMD ["bash"]