forked from William-Yeh/fswatch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (35 loc) · 979 Bytes
/
Dockerfile
File metadata and controls
50 lines (35 loc) · 979 Bytes
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
# fswatch - Watch for changes in file system.
#
#======================================#
# builder env
#
FROM golang:1.12.5 AS builder
LABEL author="william.pjyeh@gmail.com"
ENV EXE_NAME fswatch
WORKDIR /opt
# unset GOPATH in favor of GO111MODULE
ENV GO111MODULE on
ENV GOPATH ""
# fetch imported Go lib...
COPY go.mod .
COPY go.sum .
COPY fswatch.go .
COPY copy-files.sh .
# compile...
RUN GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -o $EXE_NAME-x86_64.exe
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -o $EXE_NAME-linux-x86_64
RUN GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
go build -o $EXE_NAME-mac
#======================================#
# deployment env
#
FROM alpine:3.9.4
LABEL author="william.pjyeh@gmail.com"
WORKDIR /opt
# copy executable
COPY --from=builder /opt/copy-files.sh /opt/
COPY --from=builder /opt/fswatch-* /opt/
RUN ln -s /opt/fswatch-linux-x86_64 /usr/local/bin/fswatch
CMD ["fswatch"]