Files
java/.devcontainer/Dockerfile

61 lines
2.6 KiB
Docker
Raw Normal View History

2019-12-11 05:18:22 +00:00
#-------------------------------------------------------------------------------------------------------------
2019-04-16 20:03:58 -07:00
# Copyright (c) Microsoft Corporation. All rights reserved.
2019-12-11 05:18:22 +00:00
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
2019-04-16 20:03:58 -07:00
2019-12-11 05:18:22 +00:00
FROM mcr.microsoft.com/java/jdk:8u232-zulu-ubuntu
2019-04-16 20:03:58 -07:00
2019-12-11 05:18:22 +00:00
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# 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-11 05:18:22 +00:00
# Maven settings
ARG MAVEN_VERSION=3.6.1
ARG MAVEN_SHA=b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544
ENV MAVEN_HOME=/usr/local/share/maven
COPY maven-settings.xml ${MAVEN_HOME}/ref/
# Configure apt and install packages
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-12-11 05:18:22 +00:00
# Verify git and needed tools are installed
&& apt-get -y install \
git \
iproute2 \
procps \
curl \
apt-transport-https \
gnupg2 \
lsb-release \
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 \
2019-12-11 05:18:22 +00:00
&& useradd -s /bin/bash --uid ${USER_UID} --gid ${USER_GID} -m $USERNAME \
# [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 \
2019-12-11 05:18:22 +00:00
#
# Install Maven
&& mkdir -p ${MAVEN_HOME} ${MAVEN_HOME}/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C ${MAVEN_HOME} --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s ${MAVEN_HOME}/bin/mvn /usr/local/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/*
2019-12-11 05:18:22 +00:00
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog