Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add devcontainer support for plugin development #54

Merged
merged 2 commits into from
Jan 23, 2025
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
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'"
}
Loading