first commit

This commit is contained in:
2023-08-08 21:30:55 +00:00
commit bf65852950
3 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# This Dockerfile uses separate build arguments instead of VARIANT
ARG TARGET_JAVA_VERSION=17
ARG BASE_IMAGE_VERSION_CODENAME=bookworm
FROM mcr.microsoft.com/devcontainers/base:${BASE_IMAGE_VERSION_CODENAME}
USER root
ARG TARGET_JAVA_VERSION
ENV JAVA_HOME /usr/lib/jvm/msopenjdk-current
ENV PATH "${JAVA_HOME}/bin:${PATH}"
# Default to UTF-8 file.encoding
ENV LANG en_US.UTF-8
# Install Microsoft OpenJDK
RUN arch="$(dpkg --print-architecture)" \
&& case "$arch" in \
"amd64") \
jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-x64.tar.gz"; \
;; \
"arm64") \
jdkUrl="https://aka.ms/download-jdk/microsoft-jdk-${TARGET_JAVA_VERSION}-linux-aarch64.tar.gz"; \
;; \
*) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \
esac \
\
&& wget --progress=dot:giga -O msopenjdk.tar.gz "${jdkUrl}" \
&& wget --progress=dot:giga -O sha256sum.txt "${jdkUrl}.sha256sum.txt" \
\
&& sha256sumText=$(cat sha256sum.txt) \
&& sha256=$(expr substr "${sha256sumText}" 1 64) \
&& echo "${sha256} msopenjdk.tar.gz" | sha256sum --strict --check - \
&& rm sha256sum.txt* \
\
&& mkdir -p "$JAVA_HOME" \
&& tar --extract \
--file msopenjdk.tar.gz \
--directory "$JAVA_HOME" \
--strip-components 1 \
--no-same-owner \
&& rm msopenjdk.tar.gz* \
\
&& ln -s ${JAVA_HOME} /docker-java-home \
&& ln -s ${JAVA_HOME} /usr/local/openjdk-${TARGET_JAVA_VERSION}
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@@ -0,0 +1,42 @@
{
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installGradle": "true",
"installMaven": "true"
},
"ghcr.io/devcontainers/features/node:1": "none",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
},
"ghcr.io/devcontainers-contrib/features/quarkus-sdkman:2": {}
},
"containerEnv": {
"JAVA_HOME": "/usr/lib/jvm/msopenjdk-current"
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vscjava.vscode-java-pack"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

View File

@@ -0,0 +1,3 @@
# Dev container
This devcontainer comes from: https://github.com/devcontainers/images/tree/main/src/java
Quarkus feature found here: https://containers.dev/features