Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
node_modules
32 changes: 32 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM node:20.12.2
#FROM nikolaik/python-nodejs:latest
# Last version check on 10 Apr 2024.
# Check for new versions at https://nodejs.org/en/ or at https://hub.docker.com/_/node
# Note that if you want to use this container for a Create React Application (CRA)
# you may need to use a different version. Consult React documentation.
# [Manfred]


################################################################################
# Upgrade NPM
# node may come with an older version of npm. Ensure we have a specific npm.
RUN npm install -g [email protected]
# Last version check on 10 Apr 2024.
# Newer versions might be available at https://www.npmjs.com/search?q=npm
# [Manfred]


################################################################################
# Install prerequisites
RUN apt-get update
RUN apt-get install -y \
lsb-release \
curl


################################################################################
# Install TypeScript
RUN npm install -g [email protected]
# Last version check on 10 Apr 2024.
# Newer versions might be available at https://www.npmjs.com/search?q=typescript
# [Manfred]
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "TypeScript example",
"dockerComposeFile": [
"docker-compose.yml"
],
// The name of the following service has to match one of the services in docker-compose.yml
"service": "typescript-dev",
"workspaceFolder": "/work",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"editorconfig.editorconfig",
"firsttris.vscode-jest-runner",
"github.copilot@prerelease",
"github.copilot-chat@prerelease",
"github.copilot-labs@prerelease",
"mhutchie.git-graph",
"ms-vsliveshare.vsliveshare",
"mutantdino.resourcemonitor",
"qcz.restart-ts-server-button",
"rtbenfield.vscode-jest-test-adapter",
"usernamehw.errorlens"
]
}
},
"shutdownAction": "stopCompose",
"remoteUser": "node"
}
41 changes: 41 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Documentation of compose spec can be found at https://github.com/compose-spec/compose-spec
# [Manfred, 21apr2023]

version: '3.7'

# According to the compose spec we can specify the compose project name here. However, VS Code does
# not honor this as of 21 Apr 2023. Therefore there is a .env file at the root of this git repository
# in which the environment variable COMPOSE_PROJECT_NAME is defined as 'rimutec'. Once VS Code supports
# the top-level element 'name', the following can be used instead.
name: 'developer'
# [Manfred, 21apr2023]

services:
# change the service name, the container name and the hostname for each dev container that connects
# to the same virtual network. [Manfred, 29jul2022]
typescript-dev:
image: typescript-dev:0.1
build: .
container_name: typescript-dev
hostname: typescript-dev.local
working_dir: /work
ports:
# Change the port number in case you have more than one dev container based on this
# template. For example, you could use something like:
# - "3100:3000"
# [Manfred, 29jul2022]
- "3000:3000" # <<<<<< if preferred, explicit forward the port used by express
# Using double quotes for port mapping to avoid YAML reading it as a number with a different base
# e.g. "3333:22" would result in port numbers greater than 130000 which are clearly invalid.
# Without double quotes YAML interprets it as a number based on 22. [Manfred, 24aug2022]
volumes:
- ..:/work
command: bash -c "/work/.devcontainer/init.sh && sleep infinity"
networks:
developer:

# If you list further services (ie containers) here, place them in the same virtual network if
# you want them being visible to each other. [Manfred, 10sep2022]

networks:
developer:
15 changes: 15 additions & 0 deletions .devcontainer/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# #!/bin/sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the Shebang Line

The shebang line on line 1 contains an extra # character, which prevents the interpreter directive from being recognized. Change it to #!/bin/sh so that the script runs with the correct shell.

-# #!/bin/sh
+#!/bin/sh
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# #!/bin/sh
#!/bin/sh
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


echo Running script ./.devcontainer/init.sh

################################################################################
# Set get pull mode to rebase. Do the same for branches that may exist. However
# this is a repo designed for trunk-based development, so there shouldn't be any
# branches other than 'main' [Manfred, 22aug2022]
# For more details, see https://stackoverflow.com/a/13974638/411428
runuser -l node -c 'cd /work && git config pull.rebase true'
runuser -l node -c 'cd /work && git config branch.autosetuprebase always'
# option -l specifies the user on whose behalf the commmand is executed. Note that
# this script runs as root. [Manfred, 12 Feb 2023]

echo Script ./.devcontainer/init.sh finished
17 changes: 0 additions & 17 deletions .eslintrc

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions .mocharc.json

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ cd programmable-banking-sim
```bash
npm install
```
## DevContainer (VSCode)
VS Code will automatically detect the `.devcontainer` folder and prompt you to open the project in a container. This will set up the environment for you to run the server in a Docker container.
```bash
docker-compose -f .devcontainer/docker-compose.yml up
```

## Docker
To run the server in a Docker container, run the following
Expand Down
19 changes: 0 additions & 19 deletions eslint.config.js

This file was deleted.

9 changes: 0 additions & 9 deletions jest.config.ts

This file was deleted.

Loading
Loading