-
Notifications
You must be signed in to change notification settings - Fork 74
/
Dockerfile
36 lines (32 loc) · 758 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
ARG MAINTAINER
FROM debian:stable-slim
MAINTAINER $MAINTAINER
# Install Packages (basic and Java development tools)
RUN apt-get update \
&& apt-get install -y \
sudo \
git \
curl \
gcc \
openjdk-17-jdk \
maven \
ant \
ivy \
gradle \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add java user and disable sudo password checking
RUN useradd \
--groups=sudo \
--create-home \
--home-dir=/home/java \
--shell=/bin/bash \
java \
&& sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
# Setup environment
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
RUN /bin/echo -e "export JAVA_HOME=${JAVA_HOME}" >> /home/java/.bashrc
USER java
WORKDIR /home/java
# Default shell
CMD ["/bin/bash","--login","-i"]