-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
56 lines (36 loc) · 1.2 KB
/
Dockerfile
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
# start from node image so we can install esy from npm
FROM node:alpine as build
ENV TERM=dumb LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
RUN mkdir /esy
WORKDIR /esy
ENV NPM_CONFIG_PREFIX=/esy
RUN npm install -g --unsafe-perm esy
# now that we have esy installed we need a proper runtime
FROM alpine as esy
ENV TERM=dumb LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
WORKDIR /
COPY --from=build /esy /esy
RUN apk add --no-cache ca-certificates wget bash curl perl-utils git patch gcc g++ musl-dev make m4 coreutils
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-2.30-r0.apk
RUN apk add --no-cache glibc-2.30-r0.apk
ENV PATH=/esy/bin:$PATH
RUN mkdir /app
WORKDIR /app
RUN echo ' \
{\
"name": "package-base", \
"dependencies": { \
"ocaml": "4.9.0", \
"@opam/dune": "*" \
} \
} \
' > esy.json
RUN esy
COPY esy.json esy.json
COPY esy.lock esy.lock
RUN esy fetch
RUN esy true
COPY . .
RUN esy dune build examples/now-lambda-reason/basic.exe --profile=static
RUN mv $(esy bash -c 'echo $cur__target_dir/default/examples/now-lambda-reason/basic.exe') bootstrap