Skip to content

Commit

Permalink
fix devcontainer (#3251)
Browse files Browse the repository at this point in the history
* fix devcontainer

* fix scam autentication required

* fix connection

* install pg native lib

* fix: host

* Update devcontainer.json

* Update docker-compose.yml

* Update index.js
  • Loading branch information
nigrosimone authored Jun 24, 2024
1 parent 50c06f9 commit b5281f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
6 changes: 4 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ ARG USERNAME=node
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&& apt-get -y install --no-install-recommends dialog 2>&1 \
#
# Verify git and needed tools are installed
&& apt-get -y install git iproute2 procps \
Expand All @@ -33,6 +35,7 @@ RUN apt-get update \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends yarn tmux locales postgresql \
&& apt-get install libpq-dev g++ make \
#
# Install eslint globally
&& npm install -g eslint \
Expand All @@ -47,7 +50,6 @@ RUN apt-get update \
&& apt-get install -y sudo \
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
Expand Down
33 changes: 9 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,13 @@
"dockerComposeFile": "docker-compose.yml",
"service": "web",
"workspaceFolder": "/workspace",

// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the line below if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "npm install",

// Uncomment the next line to have VS Code connect as an existing non-root user in the container. See
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
// "remoteUser": "node",

// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"dbaeumer.vscode-eslint"
]
}
"customizations":{
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}
}
}
}
13 changes: 9 additions & 4 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

version: '3'
version: '3.9'
services:
web:
# Uncomment the next line to use a non-root user for all processes. You can also
Expand Down Expand Up @@ -32,16 +32,21 @@ services:
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

links:
depends_on:
- db

links:
- db:db

db:
image: postgres
image: postgres:14-alpine
restart: unless-stopped
ports:
- 5432:5432
command: postgres -c password_encryption=md5
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_INITDB_ARGS: "--auth-local=md5"
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
POSTGRES_DB: data

0 comments on commit b5281f5

Please sign in to comment.