Skip to content

Commit 6243275

Browse files
committed
Setup development container for ShowScript
1 parent fe2942d commit 6243275

File tree

6 files changed

+102
-0
lines changed

6 files changed

+102
-0
lines changed

devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "ShowScript Development",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"VARIANT": "11",
7+
"INSTALL_MAVEN": "true",
8+
"INSTALL_GRADLE": "true"
9+
}
10+
},
11+
"settings": {
12+
"terminal.integrated.shell.linux": "/bin/bash"
13+
},
14+
"extensions": [
15+
"vscjava.vscode-java-pack",
16+
"vscjava.vscode-maven",
17+
"vscjava.vscode-gradle",
18+
"vscjava.vscode-java-test",
19+
"vscjava.vscode-java-debug",
20+
"vscjava.vscode-java-dependency",
21+
"groovy.groovy",
22+
"redhat.vscode-yaml"
23+
],
24+
"postCreateCommand": "bash /workspaces/showscriptsandbox/scripts/setup-environment.sh",
25+
"runArgs": [
26+
"--name", "showscript_dev_container",
27+
"-p", "25565:25565"
28+
],
29+
"forwardPorts": [25565],
30+
"workspaceFolder": "/workspaces/showscriptsandbox",
31+
"workspaceMount": "source=${localWorkspaceFolder}/server,target=/data,type=bind,consistency=cached"
32+
}

sandbox/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Use Paper 1.12.2 as the base image
2+
FROM itzg/minecraft-server:latest
3+
4+
# Set environment variables for Minecraft server
5+
ENV TYPE=PAPER
6+
ENV VERSION=1.12.2
7+
ENV EULA=TRUE
8+
ENV ENABLE_AUTOPAUSE=FALSE
9+
ENV MEMORY=2G
10+
ENV MAX_WORLD_SIZE=1000
11+
ENV MODE=creative
12+
ENV LEVEL_TYPE=FLAT
13+
ENV MOTD=ShowScriptSandbox
14+
ENV ALLOW_NETHER=FALSE
15+
16+
# Expose the Minecraft server port
17+
EXPOSE 25565
18+
19+
# Copy the setup script and make it executable
20+
COPY setup-environment.sh /setup-environment.sh
21+
RUN chmod +x /setup-environment.sh
22+
23+
ENTRYPOINT [ "/start" ]

sandbox/plugins.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PluginName,DirectDownloadURL
2+
EssentialsX,https://example.com/essentialsx.jar
3+
WorldEdit,https://example.com/worldedit.jar

sandbox/scripts/build-plugin.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Navigate to the project root directory
4+
cd "$(dirname "$0")/../.."
5+
6+
# Build the ShowScript plugin
7+
./gradlew build
8+
9+
# Ensure the plugins directory exists
10+
mkdir -p /workspaces/showscriptsandbox/plugins
11+
12+
# Move the built plugin jar to the plugins directory
13+
mv build/libs/showscript.jar /workspaces/showscriptsandbox/plugins/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Navigate to the plugins directory
4+
cd /workspaces/showscriptsandbox/plugins
5+
6+
# Read each line from the CSV file
7+
while IFS=, read -r pluginName directDownloadUrl
8+
do
9+
# Check if the plugin jar already exists
10+
if [ ! -f "$pluginName.jar" ]; then
11+
echo "Downloading $pluginName..."
12+
# Download the plugin jar from the direct download URL
13+
wget -O "$pluginName.jar" "$directDownloadUrl"
14+
else
15+
echo "$pluginName already exists, skipping download."
16+
fi
17+
done < /workspaces/showscriptsandbox/plugins.csv

sandbox/setup-environment.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Run script to build ShowScript
4+
bash /workspaces/showscriptsandbox/scripts/build-plugin.sh
5+
6+
# Run script to fetch other plugins if they don't exist
7+
bash /workspaces/showscriptsandbox/scripts/download-plugins.sh
8+
9+
# Start the Minecraft server
10+
cd /workspaces/showscriptsandbox
11+
12+
13+
# Attach the VSCode Console to the Minecraft server
14+
# Note: Implementation depends on the specific method used to start the server and VSCode integration

0 commit comments

Comments
 (0)