Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 643efb4

Browse files
Simplify Java Dockerfiles
Simplify Java Dockerfiles
2 parents 04315ec + 926c581 commit 643efb4

File tree

9 files changed

+111
-39
lines changed

9 files changed

+111
-39
lines changed

containers/java-11/.devcontainer/Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
44
#-------------------------------------------------------------------------------------------------------------
55

6-
FROM maven:3-jdk-11
6+
FROM openjdk:11-jdk
77

88
# Configure apt
99
ENV DEBIAN_FRONTEND=noninteractive
@@ -13,16 +13,31 @@ RUN apt-get update \
1313
# Verify git, needed tools installed
1414
RUN apt-get -y install git procps curl
1515

16-
# Install Gradle
17-
ENV GRADLE_HOME /opt/gradle
18-
ENV GRADLE_VERSION 5.4.1
19-
ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
20-
RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
21-
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
22-
&& unzip gradle.zip \
23-
&& rm gradle.zip \
24-
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
25-
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
16+
#-------------------Uncomment the following steps to install Maven CLI Tools----------------------------------
17+
# ARG MAVEN_VERSION=3.6.1
18+
# ARG MAVEN_SHA=b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544
19+
# RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
20+
# && 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 \
21+
# && echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
22+
# && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
23+
# && rm -f /tmp/apache-maven.tar.gz \
24+
# && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
25+
# COPY maven-settings.xml /usr/share/maven/ref/
26+
# ENV MAVEN_HOME /usr/share/maven
27+
# ENV MAVEN_CONFIG /root/.m2
28+
#-------------------------------------------------------------------------------------------------------------
29+
30+
#-------------------Uncomment the following steps to install Gradle CLI Tools---------------------------------
31+
# ENV GRADLE_HOME /opt/gradle
32+
# ENV GRADLE_VERSION 5.4.1
33+
# ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
34+
# RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
35+
# && echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
36+
# && unzip gradle.zip \
37+
# && rm gradle.zip \
38+
# && mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
39+
# && ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
40+
#-------------------------------------------------------------------------------------------------------------
2641

2742
# Clean up
2843
RUN apt-get autoremove -y \
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<localRepository>/usr/share/maven/ref/repository</localRepository>
6+
</settings>

containers/java-11/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Summary
44

5-
*Develop Java 11 applications. Includes the JDK 11, Maven, and Gradle build tools.*
5+
*Develop Java 11 applications. Includes JDK 11 and Java extensions.*
66

77
| Metadata | Value |
88
|----------|-------|
99
| *Contributors* | The VS Code Java Team |
1010
| *Definition type* | Dockerfile |
11-
| *Languages, platforms* | Java, Maven, Gradle |
11+
| *Languages, platforms* | Java |
1212

1313
## Using this definition with an existing folder
1414

@@ -36,6 +36,8 @@ Beyond that, just follow these steps to use the definition:
3636

3737
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
3838

39+
6. If you want to include maven or gradle build tools into your dev container, please uncomment the corresponding steps from the `containers/java-11/.devcontainer/Dockerfile`, and run **Remote-Containers: Rebuild Container** to rebuild the dev container.
40+
3941
## Testing the definition
4042

4143
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

containers/java-12/.devcontainer/Dockerfile

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,42 @@
33
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
44
#-------------------------------------------------------------------------------------------------------------
55

6-
FROM maven:3-jdk-12
6+
FROM openjdk:12-jdk
77

88
# Verify git, needed tools installed
99
RUN yum install -y git curl procps unzip
1010

11-
# Install Gradle
12-
ENV GRADLE_HOME /opt/gradle
13-
ENV GRADLE_VERSION 5.4.1
14-
ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
15-
RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
16-
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
17-
&& unzip gradle.zip \
18-
&& rm gradle.zip \
19-
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
20-
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
11+
#-------------------Uncomment the following steps to install Maven CLI Tools----------------------------------
12+
# ARG MAVEN_VERSION=3.6.1
13+
# ARG MAVEN_SHA=b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544
14+
# RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
15+
# && 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 \
16+
# && echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
17+
# && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
18+
# && rm -f /tmp/apache-maven.tar.gz \
19+
# && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
20+
# COPY maven-settings.xml /usr/share/maven/ref/
21+
# ENV MAVEN_HOME /usr/share/maven
22+
# ENV MAVEN_CONFIG /root/.m2
23+
#-------------------------------------------------------------------------------------------------------------
24+
25+
#-------------------Uncomment the following steps to install Gradle CLI Tools---------------------------------
26+
# ENV GRADLE_HOME /opt/gradle
27+
# ENV GRADLE_VERSION 5.4.1
28+
# ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
29+
# RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
30+
# && echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
31+
# && unzip gradle.zip \
32+
# && rm gradle.zip \
33+
# && mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
34+
# && ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
35+
#-------------------------------------------------------------------------------------------------------------
2136

2237
# Clean yum cache
2338
RUN yum clean all
2439

40+
# Allow for a consistent java home location for settings - image is changing over time
41+
RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi
42+
2543
# Set the default shell to bash instead of sh
2644
ENV SHELL /bin/bash
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<localRepository>/usr/share/maven/ref/repository</localRepository>
6+
</settings>

containers/java-12/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Summary
44

5-
*Develop Java 12 applications. Includes JDK 12, Maven, and Gradle build tools.*
5+
*Develop Java 12 applications. Includes JDK 12 and Java extensions.*
66

77
| Metadata | Value |
88
|----------|-------|
99
| *Contributors* | The VS Code Java Team |
1010
| *Definition type* | Dockerfile |
11-
| *Languages, platforms* | Java, Maven, Gradle |
11+
| *Languages, platforms* | Java |
1212

1313
## Using this definition with an existing folder
1414

@@ -36,6 +36,8 @@ Beyond that, just follow these steps to use the definition:
3636

3737
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
3838

39+
6. If you want to include maven or gradle build tools into your dev container, please uncomment the corresponding steps from the `containers/java-12/.devcontainer/Dockerfile`, and run **Remote-Containers: Rebuild Container** to rebuild the dev container.
40+
3941
## Testing the definition
4042

4143
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

containers/java-8/.devcontainer/Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
44
#-------------------------------------------------------------------------------------------------------------
55

6-
FROM maven:3-jdk-8
6+
FROM openjdk:8-jdk
77

88
# Configure apt
99
ENV DEBIAN_FRONTEND=noninteractive
@@ -13,16 +13,31 @@ RUN apt-get update \
1313
# Verify git, needed tools installed
1414
RUN apt-get -y install git procps curl lsb-release
1515

16-
# Install Gradle
17-
ENV GRADLE_HOME /opt/gradle
18-
ENV GRADLE_VERSION 5.4.1
19-
ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
20-
RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
21-
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
22-
&& unzip gradle.zip \
23-
&& rm gradle.zip \
24-
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
25-
&& ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
16+
#-------------------Uncomment the following steps to install Maven CLI Tools----------------------------------
17+
# ARG MAVEN_VERSION=3.6.1
18+
# ARG MAVEN_SHA=b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544
19+
# RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
20+
# && 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 \
21+
# && echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
22+
# && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
23+
# && rm -f /tmp/apache-maven.tar.gz \
24+
# && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
25+
# COPY maven-settings.xml /usr/share/maven/ref/
26+
# ENV MAVEN_HOME /usr/share/maven
27+
# ENV MAVEN_CONFIG /root/.m2
28+
#-------------------------------------------------------------------------------------------------------------
29+
30+
#-------------------Uncomment the following steps to install Gradle CLI Tools---------------------------------
31+
# ENV GRADLE_HOME /opt/gradle
32+
# ENV GRADLE_VERSION 5.4.1
33+
# ARG GRADLE_DOWNLOAD_SHA256=7bdbad1e4f54f13c8a78abc00c26d44dd8709d4aedb704d913fb1bb78ac025dc
34+
# RUN curl -sSL --output gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
35+
# && echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
36+
# && unzip gradle.zip \
37+
# && rm gradle.zip \
38+
# && mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
39+
# && ln -s "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle
40+
#-------------------------------------------------------------------------------------------------------------
2641

2742
# Clean up
2843
RUN apt-get autoremove -y \
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<localRepository>/usr/share/maven/ref/repository</localRepository>
6+
</settings>

containers/java-8/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Summary
44

5-
*Develop Java 8 applications. Includes JDK 8, Maven, and Gradle build tools.*
5+
*Develop Java 8 applications. Includes JDK 8 and Java extensions.*
66

77
| Metadata | Value |
88
|----------|-------|
99
| *Contributors* | The VS Code Java Team |
1010
| *Definition type* | Dockerfile |
11-
| *Languages, platforms* | Java, Maven |
11+
| *Languages, platforms* | Java |
1212

1313
## Using this definition with an existing folder
1414

@@ -36,6 +36,8 @@ Beyond that, just follow these steps to use the definition:
3636

3737
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
3838

39+
6. If you want to include maven or gradle build tools into your dev container, please uncomment the corresponding steps from the `containers/java-8/.devcontainer/Dockerfile`, and run **Remote-Containers: Rebuild Container** to rebuild the dev container.
40+
3941
## Testing the definition
4042

4143
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

0 commit comments

Comments
 (0)