forked from jitsucom/jitsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (32 loc) · 1.17 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
# BASE STAGE
FROM golang:1.14.6-alpine3.12 as main
ENV EVENTNATIVE_USER=eventnative
RUN addgroup -S $EVENTNATIVE_USER \
&& adduser -S -G $EVENTNATIVE_USER $EVENTNATIVE_USER \
&& mkdir -p /home/$EVENTNATIVE_USER/logs/events \
&& mkdir -p /home/$EVENTNATIVE_USER/app/res \
&& chown -R $EVENTNATIVE_USER:$EVENTNATIVE_USER /home/$EVENTNATIVE_USER
#######################################
# BUILD STAGE
FROM main as builder
# Install dependencies
RUN apk add git make bash npm
# Copy project
ADD . /go/src/github.com/jitsucom/eventnative
RUN chown -R $EVENTNATIVE_USER:$EVENTNATIVE_USER /go/src/github.com/jitsucom/eventnative
# Build
WORKDIR /go/src/github.com/jitsucom/eventnative
USER $EVENTNATIVE_USER
RUN make
# Copy static files
RUN cp -r ./build/dist/* /home/$EVENTNATIVE_USER/app/
#######################################
# FINAL STAGE
FROM main as final
USER $EVENTNATIVE_USER
WORKDIR /home/$EVENTNATIVE_USER/app
# copy static files from build-image
COPY --from=builder /home/$EVENTNATIVE_USER/app .
VOLUME ["/home/$EVENTNATIVE_USER/app/res", "/home/$EVENTNATIVE_USER/logs/events"]
EXPOSE 8001
ENTRYPOINT ["./eventnative", "-cfg=./res/eventnative.yaml", "-cr=true"]