Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Use the same base image as the original devcontainer
FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye

# Install Microsoft OpenJDK 17 and Docker
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
wget \
ca-certificates \
curl \
gnupg \
lsb-release \
&& wget -q https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
msopenjdk-17 \
docker-ce \
docker-ce-cli \
containerd.io \
&& usermod -aG docker vscode `# Add vscode user to docker group for Docker access` \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm packages-microsoft-prod.deb

# Switch to vscode user for the build
USER vscode

# Set working directory for build
WORKDIR /tmp/build

# Copy all project files for the build
COPY --chown=vscode:vscode . ./

# Pre-populate Gradle dependency and build caches by compiling all classes
# Use --no-daemon to avoid leaving daemon processes running
RUN export JAVA_HOME=/usr/lib/jvm/msopenjdk-17-amd64 && \
export PATH="$JAVA_HOME/bin:$PATH" && \
./gradlew classes --no-daemon

# Clean up the build directory but preserve gradle cache
RUN rm -rf /tmp/build

# Set default working directory for development
WORKDIR /workspaces
20 changes: 3 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
{
"name": "Application Insights Java Development Environment",
"image": "mcr.microsoft.com/vscode/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "17"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest"
}
},
"image": "ghcr.io/microsoft/applicationinsights-java/devcontainer:latest",
"customizations": {
"vscode": {
"extensions": [
"vscjava.vscode-java-pack",
"vscjava.vscode-gradle",
"redhat.java",
"ms-vscode.vscode-json"
]
}
},
"mounts": [
"source=gradle-cache,target=/home/vscode/.gradle,type=volume"
],
"remoteUser": "vscode",
"postCreateCommand": "sudo chown -R vscode:vscode /home/vscode/.gradle"
}
}
55 changes: 55 additions & 0 deletions .github/workflows/build-devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build Devcontainer Image

on:
push:
branches:
- main
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild without cache'
type: boolean
default: false

jobs:
build-and-push-devcontainer:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/devcontainer
tags: |
type=ref,event=branch
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: .devcontainer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: ${{ github.event.inputs.force_rebuild != 'true' && 'type=gha' || '' }}
cache-to: type=gha,mode=max
6 changes: 3 additions & 3 deletions smoke-tests/apps/gRPC/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ plugins {
id("com.google.protobuf") version "0.8.19"
}

val grpcVersion = "1.16.1"
val nettyVersion = "4.1.30.Final"
val grpcVersion = "1.26.0" // first version with support for arm64
val nettyVersion = "4.1.42.Final"

protobuf {
protoc {
// Download compiler rather than using locally installed version:
artifact = "com.google.protobuf:protoc:3.3.0"
artifact = "com.google.protobuf:protoc:3.5.0" // first version with support for arm64
}
plugins {
id("grpc") {
Expand Down