-
-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devcontainer #2429
base: develop
Are you sure you want to change the base?
Devcontainer #2429
Changes from 37 commits
fb46cd9
5e5b3ba
94483db
0d85405
3453a01
63db829
5af03b9
30a60c3
37ebcd9
294c279
ea8bbfd
c1efe35
0711a90
cd64b9b
978aa6e
af49f26
3e62b40
c2f0029
a0d736d
a35e64f
2e82058
56a7770
ffb745a
9a9f2c6
72ce9a1
b0a99c8
4765b00
6a7f6d4
6600ce2
63dcde3
034a06b
a69ed74
f84ec55
64d8f7d
682fdff
ac0ebee
91b90fc
6faf0c7
7023c8d
6723695
48d2845
413dc84
6c08aa4
36b1820
a4872ac
8709207
bf8b54b
fd7b6f7
b283c70
2f0bf4c
a412dd4
6cc696a
b868a11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "talawa api dev environment", | ||
"dockerComposeFile": ["../docker-compose.yaml"], | ||
"service": "devcontainer", | ||
"workspaceFolder": "/workspaces/talawa-api/content", | ||
// Settings to apply to the workspace. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"database.host": "mongodb", | ||
"redis.host": "redis-stack-server" | ||
}, | ||
// List of extensions to install inside the container | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"ms-azuretools.vscode-docker", | ||
"esbenp.prettier-vscode", | ||
"redhat.vscode-yaml" | ||
] | ||
} | ||
}, | ||
// Set up forward ports | ||
"forwardPorts": [ | ||
4000, // Server port | ||
27017, // MongoDB port | ||
6379 // Redis port | ||
], | ||
// Post-create commands to run after creating the container | ||
"postCreateCommand": "npm install", | ||
|
||
// Volumes from docker-compose are already included | ||
"shutdownAction": "stopCompose" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Stage 1: Install Dependencies | ||
FROM ubuntu:latest as builder | ||
|
||
# Set a non-interactive shell | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install Node.js and npm | ||
RUN apt-get update && apt-get install -y curl && \ | ||
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ | ||
apt-get install -y nodejs | ||
|
||
# Copy package.json and install dependencies | ||
RUN ls -la | ||
COPY package.json ./ | ||
RUN npm install | ||
|
||
# Copy the rest of your application code | ||
COPY . . | ||
|
||
# Stage 2: Final image | ||
FROM ubuntu:latest | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install Git, Node.js, and cleanup in one layer to keep the image slim | ||
RUN apt-get update && \ | ||
apt-get install -y git curl && \ | ||
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ | ||
apt-get install -y nodejs && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy built application from builder stage | ||
COPY --from=builder /usr/src/app ./ | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 4000 | ||
|
||
# Set the frontend back to dialog | ||
ENV DEBIAN_FRONTEND=dialog | ||
|
||
# Command to run the application | ||
CMD ["npm", "run", "dev"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ COPY --from=builder /usr/src/app ./ | |
|
||
EXPOSE 4000 | ||
|
||
CMD ["npm", "run", "dev"] | ||
CMD ["npm", "run", "dev"] |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -34,4 +34,4 @@ services: | |||||||
|
||||||||
volumes: | ||||||||
mongodb-data: | ||||||||
redis-data: | ||||||||
redis-data: | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a newline at the end of the file. The file is missing a newline at the end. Adding a newline is a best practice for POSIX compliance and to avoid potential issues with file concatenation. + Committable suggestion
Suggested change
Toolsyamllint
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||
services: | ||||
mongodb: | ||||
image: mongo:latest | ||||
ports: | ||||
- 27017:27017 | ||||
volumes: | ||||
- mongodb-data:/data/db | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove trailing spaces. There are trailing spaces on line 8. Trailing spaces are unnecessary and can cause issues with version control and code readability. - Committable suggestion
Suggested change
Toolsyamllint
|
||||
redis-stack-server: | ||||
image: redis/redis-stack-server:latest | ||||
ports: | ||||
- 6379:6379 | ||||
volumes: | ||||
- redis-data:/data | ||||
|
||||
devcontainer: | ||||
build: | ||||
context: . | ||||
dockerfile: Dockerfile | ||||
ports: | ||||
- "${SERVER_PORT:-4000}:4000" | ||||
volumes: | ||||
- ../..:/workspaces:cached | ||||
- /usr/src/app/node_modules | ||||
depends_on: | ||||
- mongodb | ||||
- redis-stack-server | ||||
environment: | ||||
- MONGO_DB_URL=mongodb://mongodb:27017 | ||||
- REDIS_HOST=redis-stack-server | ||||
- REDIS_PORT=6379 | ||||
|
||||
volumes: | ||||
mongodb-data: | ||||
redis-data: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why new Docker configuration? I think we can use existing Dockerfile.dev for it?