This commit is contained in:
sinedied 2023-04-11 13:41:17 +02:00
Родитель 69a3113f98
Коммит 6b36687bef
5 изменённых файлов: 38 добавлений и 66 удалений

Просмотреть файл

@ -1,35 +0,0 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java/.devcontainer/base.Dockerfile
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
ARG VARIANT="17-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
# [Option] Install Maven
ARG INSTALL_MAVEN="false"
ARG MAVEN_VERSION=""
# [Option] Install Gradle
ARG INSTALL_GRADLE="false"
ARG GRADLE_VERSION=""
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# Install Azure CLI and GitHub CLI
RUN export DEBIAN_FRONTEND=noninteractive \
&& curl -sfL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/azcli-debian.sh" | bash \
&& su vscode -c "az config set extension.use_dynamic_install=yes_without_prompt" \
&& su vscode -c "az extension add --name containerapp --upgrade" \
&& su vscode -c "az extension add --name rdbms-connect --upgrade" \
&& su vscode -c "az extension add --name log-analytics --upgrade" \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get -y install --no-install-recommends gh \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

Просмотреть файл

@ -2,18 +2,22 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/java
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a Java version: 11, 17
// Append -bullseye or -buster to pin to an OS version.
// Use the -bullseye variants on local arm64/Apple Silicon.
"VARIANT": "17-bullseye",
// Options
"INSTALL_MAVEN": "true",
"INSTALL_GRADLE": "false",
"NODE_VERSION": "lts/*"
}
"image": "mcr.microsoft.com/vscode/devcontainers/java:0-17-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
},
"ghcr.io/devcontainers/features/docker-in-docker:1": {
"version": "20",
"moby": "false",
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
// Configure tool-specific properties.
@ -38,12 +42,15 @@
"forwardPorts": [8701, 8702, 8703],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "",
"postCreateCommand": "az config set extension.use_dynamic_install=yes_without_prompt && az extension add --name containerapp --upgrade && az extension add --name rdbms-connect --upgrade && az extension add --name log-analytics --upgrade",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"git": "os-provided",
"docker-in-docker": "latest"
// At least 8gb of RAM is needed for GraalVM builds
"hostRequirements": {
"cpus": 4,
"memory": "8gb",
"storage": "32gb"
}
}

Просмотреть файл

@ -1,6 +1,6 @@
# Azure Container Apps Java Runtimes Workshop
[Check the Workshop](https://azure.github.io/aca-java-runtimes-workshop).
[Check the Workshop](https://aka.ms/java-runtimes).
## Quarkus
@ -43,7 +43,7 @@ To build a Docker image with the native application (you need to build the nativ
docker build -t micronaut-app-native -f src/main/docker/Dockerfile.native .
```
## SpringBoot
## Spring Boot
```shell
cd springboot-app
@ -55,7 +55,7 @@ curl 'localhost:8703/springboot' # Invokes the hello endpoint
To build a native application (you need GraalVM installed):
```shell
mvn -Pnative clean package
mvn -Pnative clean native:compile
./target/springboot-app
```

Просмотреть файл

@ -9,28 +9,28 @@
echo "Exporting environment variables..."
export PROJECT="java-runtimes"
export RESOURCE_GROUP="rg-${PROJECT}"
export RESOURCE_GROUP="rg-$PROJECT"
export LOCATION="eastus"
export TAG="java-runtimes"
export TAG="$PROJECT"
export LOG_ANALYTICS_WORKSPACE="logs-java-runtimes"
export CONTAINERAPPS_ENVIRONMENT="env-java-runtimes"
export LOG_ANALYTICS_WORKSPACE="log-$PROJECT"
export CONTAINERAPPS_ENVIRONMENT="cae-$PROJECT"
export UNIQUE_IDENTIFIER=${UNIQUE_IDENTIFIER:-$(whoami)}
export UNIQUE_IDENTIFIER=${UNIQUE_IDENTIFIER:-${GITHUB_USER:-$(whoami)}}
echo "Using unique identifier is: ${UNIQUE_IDENTIFIER}"
echo "Using unique identifier is: $UNIQUE_IDENTIFIER"
echo "You can override it by setting it manually before running this script:"
echo "export UNIQUE_IDENTIFIER=<your-unique-identifier>"
export REGISTRY="javaruntimesregistry${UNIQUE_IDENTIFIER}"
export REGISTRY="crjavaruntimes${UNIQUE_IDENTIFIER}"
export IMAGES_TAG="1.0"
export POSTGRES_DB_ADMIN="javaruntimesadmin"
export POSTGRES_DB_PWD="java-runtimes-p#ssw0rd-12046"
export POSTGRES_DB_VERSION="13"
export POSTGRES_DB_VERSION="14"
export POSTGRES_SKU="Standard_B1ms"
export POSTGRES_TIER="Burstable"
export POSTGRES_DB="db-stats-${UNIQUE_IDENTIFIER}"
export POSTGRES_DB="psql-stats-$UNIQUE_IDENTIFIER"
export POSTGRES_DB_SCHEMA="stats"
export POSTGRES_DB_CONNECT_STRING="jdbc:postgresql://${POSTGRES_DB}.postgres.database.azure.com:5432/${POSTGRES_DB_SCHEMA}?ssl=true&sslmode=require"

Просмотреть файл

@ -8,15 +8,15 @@ MEMORY_BITES=20
# Azure #
#########
QUARKUS_PROTOCOL=https
QUARKUS_HOST=quarkus-app.mangodesert-f75fa955.eastus.azurecontainerapps.io
QUARKUS_HOST=
QUARKUS_PORT=443
MICRONAUT_PROTOCOL=https
MICRONAUT_HOST=micronaut-app.mangodesert-f75fa955.eastus.azurecontainerapps.io
MICRONAUT_HOST=
MICRONAUT_PORT=443
SPRING_PROTOCOL=https
SPRING_HOST=springboot-app.mangodesert-f75fa955.eastus.azurecontainerapps.io
SPRING_HOST=
SPRING_PORT=443
#########