Skip to content

Commit

Permalink
Feature: Add devcontainer support for plugin development (#54)
Browse files Browse the repository at this point in the history
* Add devcontainer support for plugin Development

* Add devcontainer support for plugin Development
  • Loading branch information
Siddhi-agg authored Jan 23, 2025
1 parent f11b4ca commit b821f45
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:22.04

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN apt-get update && apt-get install -y \
coreutils \
bash \
openjdk-17-jdk \
unzip \
wget \
git \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install Gradle manually
ENV GRADLE_VERSION=8.1
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
unzip gradle-${GRADLE_VERSION}-bin.zip -d /opt && \
ln -s /opt/gradle-${GRADLE_VERSION}/bin/gradle /usr/local/bin/gradle && \
rm gradle-${GRADLE_VERSION}-bin.zip

# Set up environment variables
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
ENV GRADLE_HOME=/opt/gradle-8.1
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${JAVA_HOME}/bin:${GRADLE_HOME}/bin

# Create a non-root user
RUN useradd -ms /bin/bash devuser
USER devuser
WORKDIR /workspaces

# Verify essential commands are in path
SHELL ["/bin/bash", "-c"]
RUN echo $PATH && \
which sleep && \
which java && \
which gradle
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "KCL IntelliJ Dev Container",
"build": {
"dockerfile": "Dockerfile",
"context": "."
},
"remoteUser": "devuser",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"customizations": {
"vscode": {
"extensions": [
"vscjava.vscode-java-pack",
"vscjava.vscode-gradle",
"redhat.java",
"vscjava.vscode-maven",
"vscjava.vscode-java-debug",
"vscjava.vscode-java-test"
],
"settings": {
"java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk-amd64",
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "/usr/lib/jvm/java-17-openjdk-amd64",
"default": true
}
],
"terminal.integrated.shell.linux": "/bin/bash",
"terminal.integrated.defaultProfile.linux": "bash"
}
}
},
"remoteEnv": {
"JAVA_HOME": "/usr/lib/jvm/java-17-openjdk-amd64",
"GRADLE_HOME": "/opt/gradle-8.1",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${JAVA_HOME}/bin:${GRADLE_HOME}/bin:${PATH}"
},
"postStartCommand": "echo 'Container started successfully'"
}

0 comments on commit b821f45

Please sign in to comment.