🔨 Add dev container
This commit is contained in:
parent
5ba9ad39a3
commit
ca22827a28
23
.devcontainer/Dockerfile
Normal file
23
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
|
||||
ARG VARIANT=11-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
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [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
|
30
.devcontainer/devcontainer.json
Normal file
30
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "Java & Mariadb",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspace",
|
||||
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"java.jdt.ls.java.home": "/docker-java-home"
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack",
|
||||
"pivotal.vscode-boot-dev-pack",
|
||||
"richardwillis.vscode-gradle-extension-pack",
|
||||
"eamodio.gitlens",
|
||||
"donjayamanne.githistory"
|
||||
],
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// This can be used to network with other containers or with the host.
|
||||
// "forwardPorts": [5432],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "java -version",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
48
.devcontainer/docker-compose.yml
Normal file
48
.devcontainer/docker-compose.yml
Normal file
@ -0,0 +1,48 @@
|
||||
version: '3.8'
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
services:
|
||||
app:
|
||||
container_name: javadev
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
# Update 'VARIANT' to pick an version of Java: 11, 17.
|
||||
# Append -bullseye or -buster to pin to an OS version.
|
||||
# Use -bullseye variants on local arm64/Apple Silicon.
|
||||
VARIANT: "17"
|
||||
# Options
|
||||
INSTALL_MAVEN: "false"
|
||||
MAVEN_VERSION: ""
|
||||
INSTALL_GRADLE: "true"
|
||||
GRADLE_VERSION: "7.4.2"
|
||||
NODE_VERSION: "lts/*"
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
# Uncomment the next line to use a non-root user for all processes.
|
||||
# user: vscode
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
db:
|
||||
container_name: database
|
||||
image: mariadb:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: mariadb_root
|
||||
MARIADB_PASSWORD: claptrap
|
||||
MARIADB_USER: claptrap
|
||||
MARIADB_DATABASE: claptrap
|
||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -29,4 +29,8 @@ src/main/resources/static/error/js
|
||||
|
||||
|
||||
**.log
|
||||
.jpb/
|
||||
.jpb/
|
||||
|
||||
**/*.env
|
||||
|
||||
bin/
|
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch MainBot",
|
||||
"request": "launch",
|
||||
"mainClass": "net.Broken.MainBot",
|
||||
"projectName": "ClaptrapBot",
|
||||
"envFile": "${workspaceFolder}/.env"
|
||||
},
|
||||
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user