emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.04k stars 328 forks source link

fswatch not available in alpine docker #127

Open mickaelperrin opened 8 years ago

mickaelperrin commented 8 years ago

Hi,

That would be great if there was a fswatch package available for alpine linux.

That would be so useful when using in docker containers to reduce drastically the image size by removing all not required build tools.

Thanks

johnny-human commented 1 year ago

In alpine linux container, just do like bellow and you have it:

RUN wget https://github.com/emcrisostomo/fswatch/releases/download/1.17.1/fswatch-1.17.1.tar.gz \
    && tar -xzvf fswatch-1.17.1.tar.gz \
    && cd fswatch-1.17.1 \
    && ./configure \
    && make \
    && make install
sandercox commented 1 year ago

I was trying this together with pest watch, but I ran into an issue that in my Docker container I was getting flooded with Inotify events even when nothing changed. Couldn't quickly find any info on how to use environment or something to force a monitor to poll so I tricked it by removing the inotify header in a build container.

This is what I'm using now, and that way I just only have the poll monitor but that is fast enough and not continually rerunning my tests when nothing changes.

FROM alpine:latest AS fswatch

RUN apk add --no-cache autoconf alpine-sdk

RUN rm /usr/include/sys/inotify.h
RUN wget https://github.com/emcrisostomo/fswatch/releases/download/1.17.1/fswatch-1.17.1.tar.gz \
    && tar -xzvf fswatch-1.17.1.tar.gz \
    && cd fswatch-1.17.1 \
    && ./configure \
    && make \
    && make install \
    && rm -rf /fswatch-1.17.1

FROM alpine:latest
COPY --from=fswatch /usr/local/bin/fswatch /usr/local/bin/fswatch
COPY --from=fswatch /usr/local/lib/libfswatch.so* /usr/local/lib/