-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile-example
More file actions
63 lines (47 loc) · 1.87 KB
/
Copy pathDockerfile-example
File metadata and controls
63 lines (47 loc) · 1.87 KB
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
55
56
57
58
59
60
FROM ubuntu:20.04
ENV PURESCRIPT_VERSION 0.14.2
ARG EXAMPLE
# packages for dev environment
RUN apt-get update
RUN apt-get install -y sudo
RUN apt-get install -y git
RUN apt install -y wget
# for node version (14.17.0) that works with needed purescript version (0.14.2)
RUN wget -qO- https://deb.nodesource.com/setup_14.x | sudo bash -
RUN apt install -y nodejs
# dependancies needed for purescript (unsure if git is needed)
RUN apt update \
&& apt install -y git libtinfo5
# purescipt build tools
RUN npm install -g purescript@$PURESCRIPT_VERSION --unsafe-perm
RUN npm install -g bower
RUN npm install -g spago --unsafe-perm
# general browers build and serve tools
RUN npm install -g browserify
RUN npm install -g http-server
#smoke tests
RUN purs --version
# create the project
WORKDIR /
RUN mkdir example-project
WORKDIR /example-project/
RUN spago init
# replace files in spago project with (this is probably not the best way to do this, but wanted to show how to go from 'spago init' to a working example)
ADD example-resources/index.html /example-project/
ADD example-resources/package.json /example-project/
ADD example-resources/packages.dhall /example-project/
ADD example-resources/spago-project.dhall /example-project/spago.dhall
ADD example-resources/examples/$EXAMPLE /example-project/src/Main.purs
ADD example-resources/SimpleFramework.purs /example-project/src/
ADD . /example-project/snabbare
ADD example-resources/spago-library.dhall /example-project/snabbare/spago.dhall
# build the example project
RUN npm install
RUN spago build
RUN spago bundle-app --no-install --main Main --to build/index.js
RUN browserify build/index.js -o build/bundle.js
# serve the example project
ENTRYPOINT http-server
# docker build --build-arg EXAMPLE=Input.purs -t test-example --file Dockerfile-example .
# docker run -p 8080:8080 -it test-example /bin/bash
# docker start -i -a test-example