forked from IcaliaLabs/docker-watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (53 loc) · 1.93 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
57
58
59
60
61
62
63
64
65
66
67
# Stage I: Runtime =============================================================
# Step 1: Begin with Alpine 3.15:
FROM alpine:3.15 AS runtime
ARG WATCHMAN_VERSION
ARG WATCHMAN_SHA256
ENV WATCHMAN_VERSION=${WATCHMAN_VERSION} \
WATCHMAN_SHA256=${WATCHMAN_SHA256}
# Step 2: Install watchman runtime dependencies:
RUN apk add --no-cache libcrypto1.1 libgcc libstdc++
# Stage II: Builder ============================================================
# Step 3: Begin from runtime stage image:
FROM runtime AS builder
# Step 4: Install the watchman build dependencies:
RUN apk add --no-cache \
autoconf \
automake \
bash \
build-base \
ca-certificates \
libtool \
linux-headers \
openssl \
openssl-dev \
pkgconf \
python3-dev
# Step 5: Download watchman source code:
RUN cd /tmp \
&& wget -O watchman.tar.gz "https://github.com/facebook/watchman/archive/v${WATCHMAN_VERSION}.tar.gz" \
&& echo "$WATCHMAN_SHA256 *watchman.tar.gz" | sha256sum -c - \
&& tar -xz -f watchman.tar.gz -C /tmp/ \
&& rm -rf watchman.tar.gz
# Step 6: Apply Build Patch
# (https://github.com/facebook/watchman/issues/937#issuecomment-904717182)
COPY ./watchman_autogen.sh.diff /tmp/
RUN cd /tmp/watchman-${WATCHMAN_VERSION} \
&& patch autogen.sh < /tmp/watchman_autogen.sh.diff
# Step 7: Build watchman from source:
RUN cd /tmp/watchman-${WATCHMAN_VERSION} \
&& ./autogen.sh \
&& ./configure --enable-lenient \
&& make \
&& make install \
&& cd $HOME \
&& rm -rf /tmp/*
# Stage III: Release ===========================================================
# Step 8: Begin with the runtime stage image:
FROM runtime AS release
# Step 9: Copy the compiled executable:
COPY --from=builder /usr/local/bin/watchman* /usr/local/bin/
# Step 10: Copy the documentation:
COPY --from=builder /usr/local/share/doc/watchman-4.9.0 /usr/local/share/doc/watchman-4.9.0
# Step 11: Copy the runtime directories:
COPY --from=builder /usr/local/var/run/watchman /usr/local/var/run/watchman