devcontainer: bump node version to 18 (#523)

pull/524/head
panda 2 years ago committed by GitHub
parent 909c5a785f
commit 9cd7c5cfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,20 +1,9 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:18-bullseye
ARG VARIANT=16-bullseye ADD https://github.com/criyle/go-judge/releases/download/v1.6.3/executorserver_1.6.3_linux_amd64 /usr/bin/sandbox
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} RUN npm install -g yarn && \
sudo apt-get update && sudo apt-get install gcc g++ && \
# Install MongoDB command line tools if on buster and x86_64 (arm64 not supported) mkdir -p /root/.hydro /data/file && chmod +x /usr/bin/sandbox && \
ARG MONGO_TOOLS_VERSION=5.0 chown -R root:root /root /root/.hydro /data/file && \
RUN . /etc/os-release \ echo '{"uri":"mongodb://mongo/hydro"}' > /root/.hydro/config.json && \
&& if [ "${VERSION_CODENAME}" = "buster" ] && [ "$(dpkg --print-architecture)" = "amd64" ]; then \ echo '["@hydrooj/ui-default","@hydrooj/hydrojudge"]' > /root/.hydro/addon.json
curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \ ENTRYPOINT sandbox
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian $(lsb_release -cs)/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y mongodb-database-tools mongodb-mongosh \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*; \
fi
RUN npm i pm2 yarn -g && \
sudo apt-get update && \
sudo apt-get install clang -y --no-install-recommends && \
mkdir -p ~/.hydro && \
echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >~/.hydro/config.json && \

@ -1,32 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/javascript-node-mongo
// Update the VARIANT arg in docker-compose.yml to pick a Node.js version
{ {
"name": "Node.js & Mongo DB", "name": "Hydro Dev Container",
"dockerComposeFile": "docker-compose.yml", "dockerComposeFile": "docker-compose.yml",
"service": "app", "service": "hydro",
"workspaceFolder": "/workspace", "workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create. "customizations": {
"settings": {}, "vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"gruntfuggly.todo-tree", "gruntfuggly.todo-tree",
"ronnidc.nunjucks", "ronnidc.nunjucks",
"sysoev.language-stylus", "eamodio.gitlens",
"vscode-icons-team.vscode-icons" "vscode-icons-team.vscode-icons",
], "sysoev.language-stylus"
// Use 'forwardPorts' to make a list of ports inside the container available locally. ]
}
},
"remoteUser": "root",
"forwardPorts": [ "forwardPorts": [
2333, 2333,
27017, 8000
8888
], ],
// Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "git submodule update --init && yarn install && npx hydrooj cli system set server.port 2333 && npx hydrooj cli user create root@hydro.local root rootroot 2 && npx hydrooj cli user setSuperAdmin 2"
"postCreateCommand": "yarn install && npx hydrooj cli system set server.port 2333 && npx hydrooj cli user create root@hydro.local root rootroot 2 && npx hydrooj cli user setSuperAdmin 2",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root",
"features": {
"ghcr.io/devcontainers/features/git:1": {}
}
} }

@ -1,22 +1,21 @@
version: '3.8' version: '3.9'
services: services:
app: mongo:
image: mongo:4-focal
restart: unless-stopped
volumes:
- mongodb-data:/data/db
hydro:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args: privileged: true
VARIANT: 16 depends_on:
- mongo
volumes: volumes:
- ..:/workspace:cached - ..:/workspace:cached
- testdata:/data/file - testdata:/data/file
command: sleep infinity
network_mode: service:db
db:
image: mongo:latest
restart: unless-stopped
volumes:
- mongodb-data:/data/db
volumes: volumes:
mongodb-data: mongodb-data:

@ -7,6 +7,9 @@ tasks:
init: | init: |
mkdir -p /home/gitpod/.hydro mkdir -p /home/gitpod/.hydro
echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json && \ echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json && \
nvm install 18
nvm use 18
nvm alias default 18
yarn yarn
yarn build:ui:production yarn build:ui:production
npx hydrooj cli system set server.port 2333 npx hydrooj cli system set server.port 2333

Loading…
Cancel
Save