forked from zendesk/maxwell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (24 loc) · 943 Bytes
/
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
FROM maven:3.6-jdk-11 as builder
ENV MAXWELL_VERSION=1.37.2 KAFKA_VERSION=1.0.0
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y make
# prime so we can have a cached image of the maven deps
COPY pom.xml /tmp
RUN cd /tmp && mvn dependency:resolve
COPY . /workspace
RUN cd /workspace \
&& KAFKA_VERSION=$KAFKA_VERSION make package MAXWELL_VERSION=$MAXWELL_VERSION \
&& mkdir /app \
&& mv /workspace/target/maxwell-$MAXWELL_VERSION/maxwell-$MAXWELL_VERSION/* /app/ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /workspace/ /root/.m2/ \
&& echo "$MAXWELL_VERSION" > /REVISION
# Build clean image with non-root priveledge
FROM openjdk:11-jdk-slim
COPY --from=builder /app /app
WORKDIR /app
RUN useradd -u 1000 maxwell -d /app
RUN chown 1000:1000 /app && echo "$MAXWELL_VERSION" > /REVISION
USER 1000
CMD [ "/bin/bash", "-c", "bin/maxwell-docker" ]