forked from jitsucom/jitsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configurator-release.Dockerfile
67 lines (48 loc) · 2.16 KB
/
configurator-release.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
# BASE STAGE
FROM alpine:3.13 as main
RUN apk add --no-cache build-base python3 py3-pip python3-dev tzdata bash sudo
ARG dhid
ENV DOCKER_HUB_ID=$dhid
ENV CONFIGURATOR_USER=configurator
ENV TZ=UTC
RUN addgroup -S $CONFIGURATOR_USER \
&& adduser -S -G $CONFIGURATOR_USER $CONFIGURATOR_USER \
&& mkdir -p /home/$CONFIGURATOR_USER/data/logs \
&& mkdir -p /home/$CONFIGURATOR_USER/data/config \
&& mkdir -p /home/$CONFIGURATOR_USER/app/web \
&& chown -R $CONFIGURATOR_USER:$CONFIGURATOR_USER /home/$CONFIGURATOR_USER
# Create symlink for backward compatibility
RUN ln -s /home/$CONFIGURATOR_USER/data/config /home/$CONFIGURATOR_USER/app/res && \
ln -s /home/$CONFIGURATOR_USER/data/logs /home/$CONFIGURATOR_USER/logs && \
chown -R $CONFIGURATOR_USER:$CONFIGURATOR_USER /home/$CONFIGURATOR_USER/logs
#######################################
# BUILD BACKEND STAGE
FROM jitsucom/configurator-builder as builder
ENV CONFIGURATOR_USER=configurator
RUN mkdir -p /go/src/github.com/jitsucom/jitsu/$CONFIGURATOR_USER/backend && \
mkdir -p /go/src/github.com/jitsucom/jitsu/server
WORKDIR /go/src/github.com/jitsucom/jitsu/$CONFIGURATOR_USER/backend
#Caching dependencies
ADD configurator/backend/go.mod ./
ADD server/go.mod /go/src/github.com/jitsucom/jitsu/server/
RUN go mod tidy && go mod download
#Copy backend
ADD configurator/backend/. ./.
ADD server /go/src/github.com/jitsucom/jitsu/server
ADD .git /go/src/github.com/jitsucom/jitsu/.git
# Build
RUN make docker_assemble
#######################################
# FINAL STAGE
FROM main as final
# add frontend
ADD configurator/frontend/build/ /home/$CONFIGURATOR_USER/app/web/
# add backend
COPY --from=builder /go/src/github.com/jitsucom/jitsu/$CONFIGURATOR_USER/backend/build/dist/configurator /home/$CONFIGURATOR_USER/app/configurator
RUN chown -R $CONFIGURATOR_USER:$CONFIGURATOR_USER /home/$CONFIGURATOR_USER/app
USER $CONFIGURATOR_USER
WORKDIR /home/$CONFIGURATOR_USER/app
COPY docker/configurator.yaml /home/$CONFIGURATOR_USER/data/config/
VOLUME ["/home/$CONFIGURATOR_USER/data"]
EXPOSE 7000
ENTRYPOINT ./configurator -cfg=/home/$CONFIGURATOR_USER/data/config/configurator.yaml -cr=true -dhid="$DOCKER_HUB_ID"