mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(.devcontainer): basic codespaces config (#48484)
Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
ARG VARIANT=20.04
|
||||
FROM mcr.microsoft.com/devcontainers/base:ubuntu-${VARIANT}
|
||||
|
||||
ARG NODE_VERSION=18
|
||||
ARG MONGODB_VERSION=6.0.4
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y sudo && \
|
||||
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | sudo -E bash - && \
|
||||
sudo apt-get install -y nodejs && \
|
||||
sudo apt-get install -y libcurl4 openssl liblzma5 && \
|
||||
mkdir -p /tmp/mongodb && \
|
||||
cd /tmp/mongodb && \
|
||||
wget -qOmongodb.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-${MONGODB_VERSION}.tgz && \
|
||||
tar -zxvf mongodb.tgz && \
|
||||
cd mongodb-* && \
|
||||
sudo cp bin/* /usr/local/bin/ && \
|
||||
rm -rf /tmp/mongodb && \
|
||||
sudo mkdir -p /data/db && \
|
||||
sudo chown vscode:vscode -R /data/db
|
||||
|
||||
# Setup ENV
|
||||
ENV COOKIE_DOMAIN=github.dev
|
||||
ENV HOME_LOCATION=https://$CODESPACE_NAME-8000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
|
||||
ENV API_LOCATION=https://$CODESPACE_NAME-3000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
|
||||
ENV CYPRESS_BASE_URL=https://$CODESPACE_NAME-8000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
|
||||
ENV REACT_APP_CHALLENGE_EDITOR_API_LOCATION=https://$CODESPACE_NAME-3200.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
|
||||
ENV CHALLENGE_EDITOR_CLIENT_LOCATION=https://$CODESPACE_NAME-3300.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"freeCodeCamp.freecodecamp-dark-vscode-theme"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dockerFile": "Dockerfile",
|
||||
"forwardPorts": [3000, 8000, 27017],
|
||||
"portsAttributes": {
|
||||
"8000": {
|
||||
"label": "Learn",
|
||||
"onAutoForward": "openPreview"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "cp sample.env .env && npm ci",
|
||||
// It is more reliable to start these processes oneself
|
||||
// "postStartCommand": "mongod &",
|
||||
// "postAttachCommand": "npm run develop",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM node:18-alpine
|
||||
|
||||
# Install git
|
||||
RUN apk add --no-cache git
|
||||
|
||||
RUN npm install -g docsify-cli prettier eslint
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"context": "../..",
|
||||
"customizations": {
|
||||
"codespaces": {
|
||||
"openFiles": ["docs/how-to-work-on-the-docs-theme.md"]
|
||||
},
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"freeCodeCamp.freecodecamp-dark-vscode-theme"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dockerFile": "Dockerfile",
|
||||
"forwardPorts": [3400],
|
||||
"portsAttributes": {
|
||||
"3400": {
|
||||
"label": "Docs",
|
||||
"onAutoForward": "openPreview"
|
||||
}
|
||||
},
|
||||
"postAttachCommand": "npm run docs:serve"
|
||||
}
|
||||
Reference in New Issue
Block a user