-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add devcontainer support for judgels development
This patch add initial configs for devcontainer, development inside container using vscode. https://code.visualstudio.com/docs/devcontainers/containers To use it, simply open judgels as follow: $ git clone https://github.com/ia-toki/judgels.git $ cd judgels $ code . Different container runtimes might need additional step. For example, with colima on macOS, the source code directory need to be mounted on start such as follow: $ colima start --cpu 6 --memory 16 --mount $JUDGELS_HOME:$JUDGELS_HOME:w Where $JUDGELS_HOME is an environment variable to judgels source code path in host filesystem. Testing: - Successfully compile the code with devcontainer on macOS
- Loading branch information
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y sudo git \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata \ | ||
&& addgroup --gid "${USER_GID}" tokidev \ | ||
&& adduser --uid "${USER_UID}" --gid "${USER_GID}" --disabled-password --gecos '' tokidev \ | ||
&& echo 'tokidev ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
EXPOSE 9101 | ||
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Impala Dev", | ||
"dockerFile": "Dockerfile", | ||
"runArgs": [ | ||
"--privileged", | ||
], | ||
"remoteUser": "tokidev", | ||
"containerUser": "tokidev", | ||
"postCreateCommand": "echo 'yes' | bin/bootstrap_system.sh", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"vscjava.vscode-java-pack" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is intended to install the minimum requirement to start | ||
# developing judgels in ubuntu20.04 | ||
|
||
set -eu -o pipefail | ||
|
||
: ${JUDGELS_HOME:=$(cd "$(dirname $0)"/..; pwd)} | ||
export JUDGELS_HOME | ||
|
||
if [[ -t 1 ]] # if on an interactive terminal | ||
then | ||
echo "This script will clobber some system settings. Are you sure you want to" | ||
echo -n "continue? " | ||
while true | ||
do | ||
read -p "[yes/no] " ANSWER | ||
ANSWER=$(echo "$ANSWER" | tr /a-z/ /A-Z/) | ||
if [[ $ANSWER = YES ]] | ||
then | ||
break | ||
elif [[ $ANSWER = NO ]] | ||
then | ||
echo "OK, Bye!" | ||
exit 1 | ||
fi | ||
done | ||
fi | ||
|
||
set -x | ||
|
||
# install tools via apt-get | ||
UBUNTU_JAVA_VERSION="11" | ||
sudo apt-get --yes install git ssh wget curl unzip vim-common \ | ||
openjdk-${UBUNTU_JAVA_VERSION}-jdk openjdk-${UBUNTU_JAVA_VERSION}-source \ | ||
openjdk-${UBUNTU_JAVA_VERSION}-dbg npm mysql-client | ||
|
||
# setup mysql server as a separate docker container, such as: | ||
# docker run --name mysql -e MYSQL_ROOT_PASSWORD=judgels-root \ | ||
# -e MYSQL_DATABASE=judgels -d mysql:8 | ||
|
||
# install yarn | ||
sudo npm install --global yarn | ||
|
||
java --version | ||
npm --version | ||
yarn --version | ||
|
||
# assemble judgels-server-app | ||
cd $JUDGELS_HOME/judgels-backends/judgels-server-app | ||
cp var/conf/judgels-server.yml.example var/conf/judgels-server.yml | ||
../gradlew assemble | ||
|
||
# build judgels-client | ||
cd $JUDGELS_HOME/judgels-client | ||
cp public/var/conf/judgels-client.js.example public/var/conf/judgels-client.js | ||
yarn install | ||
|
||
# TODO: to start judgels-server-app and judgels-client, | ||
# follow the remaining instruction at: | ||
# https://github.com/ia-toki/judgels/wiki/Dev's-Guide:-Running-from-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE USER 'judgels'@'%' IDENTIFIED WITH mysql_native_password BY 'judgels'; | ||
GRANT ALL PRIVILEGES ON * . * TO 'judgels'@'%'; | ||
FLUSH PRIVILEGES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ generated_tests/ | |
|
||
data/ | ||
|
||
.devcontainer/* | ||
.idea/ | ||
.ideaDataSources/ | ||
*.iml | ||
|