-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Dockerfile
37 lines (27 loc) · 992 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
34
35
36
37
FROM maven:3.8-jdk-11 as builder
ENV MAXWELL_VERSION=1.41.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
RUN apt-get update \
&& apt-get -y upgrade
COPY --from=builder /app /app
COPY --from=builder /REVISION /REVISION
WORKDIR /app
RUN useradd -u 1000 maxwell -d /app
RUN chown 1000:1000 /app
USER 1000
CMD [ "/bin/bash", "-c", "bin/maxwell-docker" ]