Created a dev container, that sets up everything.
This commit is contained in:
		
							parent
							
								
									c5e7276413
								
							
						
					
					
						commit
						60a86fc08f
					
				
							
								
								
									
										2
									
								
								.devcontainer/.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.devcontainer/.dockerignore
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					node_modules
 | 
				
			||||||
 | 
					package-lock.json
 | 
				
			||||||
							
								
								
									
										54
									
								
								.devcontainer/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								.devcontainer/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					# Image: https://hub.docker.com/_/node
 | 
				
			||||||
 | 
					FROM node:21-bullseye
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Default location in container for VS Code to mount files into
 | 
				
			||||||
 | 
					WORKDIR /workspace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Copies everything from the root of the repository into the image
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Updates the package index and installs git
 | 
				
			||||||
 | 
					RUN apt-get update \
 | 
				
			||||||
 | 
					    && apt-get -y install git \
 | 
				
			||||||
 | 
					    && apt-get clean -y && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# We need to install the following packages to be able to install MongoDB
 | 
				
			||||||
 | 
					RUN apt-get install gnupg curl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Adds the MongoDB public key to the system
 | 
				
			||||||
 | 
					RUN curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \
 | 
				
			||||||
 | 
					    gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
 | 
				
			||||||
 | 
					   --dearmor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Creates the /etc/apt/sources.list.d/mongodb-org-7.0.list file for MongoDB
 | 
				
			||||||
 | 
					RUN echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Reload local package database
 | 
				
			||||||
 | 
					RUN apt-get update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Installs the MongoDB
 | 
				
			||||||
 | 
					RUN apt-get install -y mongodb-org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Installs pnpm
 | 
				
			||||||
 | 
					RUN npm install -g pnpm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Install MongoDB from the official repository
 | 
				
			||||||
 | 
					RUN apt-get install -y mongodb-org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Creates the MongoDB data directory
 | 
				
			||||||
 | 
					RUN mkdir -p /data/db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Installs dependencies
 | 
				
			||||||
 | 
					RUN pnpm install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Expose MongoDB port
 | 
				
			||||||
 | 
					EXPOSE 27017
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Expose required ports
 | 
				
			||||||
 | 
					EXPOSE 3000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Run MongoDB
 | 
				
			||||||
 | 
					CMD mongod --fork --logpath /var/log/mongodb.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# When the container starts, run the launch script
 | 
				
			||||||
 | 
					ENTRYPOINT [ "pnpm", "run", "dev" ]
 | 
				
			||||||
							
								
								
									
										39
									
								
								.devcontainer/devcontainer.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								.devcontainer/devcontainer.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					// 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.231.6/containers/docker-existing-dockerfile
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  "name": "wf.emulator.dev",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Sets the run context to one level up instead of the .devcontainer folder.
 | 
				
			||||||
 | 
					  "context": "..",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
 | 
				
			||||||
 | 
					  "dockerFile": "./Dockerfile",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Set *default* container specific settings.json values on container create.
 | 
				
			||||||
 | 
					  "settings": {},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Add the IDs of extensions you want installed when the container is created.
 | 
				
			||||||
 | 
					  "extensions": [
 | 
				
			||||||
 | 
					    "aaron-bond.better-comments",
 | 
				
			||||||
 | 
					    "ms-vscode-remote.vscode-remote-extensionpack",
 | 
				
			||||||
 | 
					    "streetsidesoftware.code-spell-checker",
 | 
				
			||||||
 | 
					    "ms-azuretools.vscode-docker",
 | 
				
			||||||
 | 
					    "dbaeumer.vscode-eslint",
 | 
				
			||||||
 | 
					    "waderyan.gitblame",
 | 
				
			||||||
 | 
					    "wix.vscode-import-cost",
 | 
				
			||||||
 | 
					    "VisualStudioExptTeam.vscodeintellicode",
 | 
				
			||||||
 | 
					    "VisualStudioExptTeam.intellicode-api-usage-examples",
 | 
				
			||||||
 | 
					    "ms-vscode.vscode-typescript-next",
 | 
				
			||||||
 | 
					    "mongodb.mongodb-vscode",
 | 
				
			||||||
 | 
					    "esbenp.prettier-vscode",
 | 
				
			||||||
 | 
					    "yoavbls.pretty-ts-errors",
 | 
				
			||||||
 | 
					    "syler.sass-indented",
 | 
				
			||||||
 | 
					    "redhat.vscode-yaml"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
				
			||||||
 | 
					  "forwardPorts": [3000, 27017],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  "postCreateCommand": "mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db",
 | 
				
			||||||
 | 
					  "postStartCommand": "echo 'MongoDB@27017 started, modules installed, and ready to go! <3 Sincerely, Smultar'"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user