-
Notifications
You must be signed in to change notification settings - Fork 84
/
Dockerfile
45 lines (34 loc) · 1.71 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
## Builds an image containing jgroups-raft
## ***************************************************************
## Make sure you have jgroups-raft compiled (mvn clean package) before doing so!
## ***************************************************************
## The first stage is used to prepare/update the OS.
## The second stage copies the local files (lib:classes) to the image
# Build: docker build -f Dockerfile -t belaban/jgroups-raft .
# Push: docker push belaban/jgroups-raft
FROM adoptopenjdk/openjdk11:jre as build-stage
RUN apt-get update ; apt-get install -y git ant net-tools netcat iputils-ping
# For the runtime, we only need a JRE (smaller footprint)
FROM adoptopenjdk/openjdk11:jre
LABEL maintainer="Bela Ban ([email protected])"
RUN useradd --uid 1000 --home /opt/jgroups --create-home --shell /bin/bash jgroups
RUN echo root:root | chpasswd ; echo jgroups:jgroups | chpasswd
RUN printf "\njgroups ALL=(ALL) NOPASSWD: ALL\n" >> /etc/sudoers
# EXPOSE 7800-7900:7800-7900 9000-9100:9000-9100
EXPOSE 1965-1975:2065-2075 8787
ENV HOME /opt/jgroups
ENV PATH $PATH:$HOME/jgroups-raft/bin
ENV JGROUPS_RAFT_HOME=$HOME/jgroups-raft
WORKDIR /opt/jgroups
COPY --from=build-stage /bin/ping /bin/netstat /bin/nc /bin/
COPY --from=build-stage /sbin/ifconfig /sbin/
COPY README.md $JGROUPS_RAFT_HOME/
COPY ./target/classes $JGROUPS_RAFT_HOME/classes
COPY ./target/libs $JGROUPS_RAFT_HOME/lib
COPY ./bin $JGROUPS_RAFT_HOME/bin
COPY ./conf $JGROUPS_RAFT_HOME/conf
RUN mkdir /mnt/data ; chown -R jgroups.jgroups /mnt/data $HOME/*
# Run everything below as the jgroups user. Unfortunately, USER is only observed by RUN, *not* by ADD or COPY !!
USER jgroups
RUN chmod u+x $HOME/*
CMD clear && cat $HOME/jgroups-raft/README.md && /bin/bash