File tree 6 files changed +77
-54
lines changed
6 files changed +77
-54
lines changed Original file line number Diff line number Diff line change
1
+ FROM mcr.microsoft.com/devcontainers/javascript-node:0-20
2
+
3
+ # [Optional] Uncomment this section to install additional OS packages.
4
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
6
+
7
+ # [Optional] Uncomment if you want to install an additional version of node using nvm
8
+ # ARG EXTRA_NODE_VERSION=10
9
+ # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
10
+
11
+ # [Optional] Uncomment if you want to install more global node modules
12
+ # RUN su node -c "npm install -g <your-package-list-here>"
Original file line number Diff line number Diff line change
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node-postgres
3
+ {
4
+ "name" : " Node.js & PostgreSQL" ,
5
+ "dockerComposeFile" : " docker-compose.yml" ,
6
+ "service" : " app" ,
7
+ "workspaceFolder" : " /workspaces/${localWorkspaceFolderBasename}" ,
8
+
9
+ // Features to add to the dev container. More info: https://containers.dev/features.
10
+ "features" : {
11
+ "ghcr.io/devcontainers/features/docker-outside-of-docker:1" : {
12
+ "version" : " latest"
13
+ }
14
+ },
15
+
16
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
17
+ // This can be used to network with other containers or with the host.
18
+ "forwardPorts" : [3000 , 5432 ]
19
+
20
+ // Use 'postCreateCommand' to run commands after the container is created.
21
+ // "postCreateCommand": "yarn install",
22
+
23
+ // Configure tool-specific properties.
24
+ // "customizations": {},
25
+
26
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
27
+ // "remoteUser": "root"
28
+ }
Original file line number Diff line number Diff line change
1
+ version : ' 3.8'
2
+
3
+ services :
4
+ app :
5
+ build :
6
+ context : .
7
+ dockerfile : Dockerfile
8
+
9
+ volumes :
10
+ - ../..:/workspaces:cached
11
+
12
+ # Overrides default command so things don't shut down after the process ends.
13
+ command : sleep infinity
14
+
15
+ # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
16
+ network_mode : service:db
17
+ environment :
18
+ - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?schema=public
19
+
20
+ # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
21
+ # (Adding the "ports" property to this file will not forward from a Codespace.)
22
+
23
+ db :
24
+ image : postgres:latest
25
+ restart : unless-stopped
26
+ volumes :
27
+ - postgres-data:/var/lib/postgresql/data
28
+ environment :
29
+ POSTGRES_PASSWORD : postgres
30
+ POSTGRES_USER : postgres
31
+ POSTGRES_DB : postgres
32
+
33
+ # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
34
+ # (Adding the "ports" property to this file will not forward from a Codespace.)
35
+
36
+ volumes :
37
+ postgres-data :
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments