From bf65852950e5b3cdc6cf7cd09b1453bff752b236 Mon Sep 17 00:00:00 2001 From: Rasmus Lauritsen Date: Tue, 8 Aug 2023 21:30:55 +0000 Subject: [PATCH] first commit --- QuarkusDevcontainer/.devcontainer/Dockerfile | 46 +++++++++++++++++++ .../.devcontainer/devcontainer.json | 42 +++++++++++++++++ QuarkusDevcontainer/.devcontainer/readme.md | 3 ++ 3 files changed, 91 insertions(+) create mode 100644 QuarkusDevcontainer/.devcontainer/Dockerfile create mode 100644 QuarkusDevcontainer/.devcontainer/devcontainer.json create mode 100644 QuarkusDevcontainer/.devcontainer/readme.md diff --git a/QuarkusDevcontainer/.devcontainer/Dockerfile b/QuarkusDevcontainer/.devcontainer/Dockerfile new file mode 100644 index 0000000..47aa7b8 --- /dev/null +++ b/QuarkusDevcontainer/.devcontainer/Dockerfile @@ -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 diff --git a/QuarkusDevcontainer/.devcontainer/devcontainer.json b/QuarkusDevcontainer/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fead90d --- /dev/null +++ b/QuarkusDevcontainer/.devcontainer/devcontainer.json @@ -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" +} \ No newline at end of file diff --git a/QuarkusDevcontainer/.devcontainer/readme.md b/QuarkusDevcontainer/.devcontainer/readme.md new file mode 100644 index 0000000..f64d30a --- /dev/null +++ b/QuarkusDevcontainer/.devcontainer/readme.md @@ -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 \ No newline at end of file