forked from jitsucom/jitsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configurator-release.Dockerfile
76 lines (57 loc) · 2.55 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
68
69
70
71
72
73
74
75
76
# BASE STAGE
FROM debian:bullseye-slim as main
# Install dependencies
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get install -y --fix-missing bash python3 python3-pip python3-venv python3-dev sudo curl dnsutils
ARG TARGETARCH
ARG dhid
ENV DOCKER_HUB_ID=$dhid
ENV CONFIGURATOR_USER=configurator
ENV TZ=UTC
RUN echo "$CONFIGURATOR_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& addgroup --system $CONFIGURATOR_USER \
&& adduser --system $CONFIGURATOR_USER \
&& adduser $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/jitsu-builder:$TARGETARCH 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 download
#Copy backend
ADD openapi /go/src/github.com/jitsucom/jitsu/openapi
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/main/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
ADD configurator/backend/entrypoint.sh /home/$CONFIGURATOR_USER/entrypoint.sh
RUN chmod +x /home/$CONFIGURATOR_USER/entrypoint.sh
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 /home/$CONFIGURATOR_USER/entrypoint.sh