Files
java/.devcontainer/Dockerfile

48 lines
2.0 KiB
Docker
Raw Normal View History

2020-07-30 23:21:12 +08:00
FROM openjdk:11-jdk
2019-12-11 05:18:22 +00:00
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
2019-08-06 01:08:09 +00:00
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
2019-12-17 04:01:40 +00:00
ARG MAVEN_VERSION=3.6.3
ARG MAVEN_SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
2019-12-11 05:18:22 +00:00
2020-04-09 00:34:36 +00:00
COPY maven-settings.xml /usr/share/maven/ref/
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG /root/.m2
# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
2019-08-06 01:08:09 +00:00
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
2019-06-20 23:23:55 +00:00
#
2019-08-06 01:08:09 +00:00
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
2020-04-09 00:34:36 +00:00
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
2019-12-11 05:18:22 +00:00
# [Optional] Add sudo support for the non-root user
2019-08-06 01:08:09 +00:00
&& apt-get install -y sudo \
2019-12-11 05:18:22 +00:00
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
2019-08-06 01:08:09 +00:00
&& chmod 0440 /etc/sudoers.d/$USERNAME \
2020-04-09 00:34:36 +00:00
#
# Verify git, needed tools installed
&& apt-get -y install git openssh-client less iproute2 procps curl lsb-release \
#
2019-12-11 05:18:22 +00:00
# Install Maven
2020-04-09 00:34:36 +00:00
&& mkdir -p /usr/share/maven /usr/share/maven/ref \
2019-12-17 04:01:40 +00:00
&& curl -fsSL -o /tmp/apache-maven.tar.gz https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
2019-12-11 05:18:22 +00:00
&& echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
2020-04-09 00:34:36 +00:00
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
2019-12-11 05:18:22 +00:00
&& rm -f /tmp/apache-maven.tar.gz \
2020-04-09 00:34:36 +00:00
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn \
2019-08-06 01:08:09 +00:00
#
2019-06-20 23:23:55 +00:00
# Clean up
&& apt-get autoremove -y \
2019-04-16 20:03:58 -07:00
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
2020-04-09 00:34:36 +00:00
ENV DEBIAN_FRONTEND=dialog