Skip to content

Commit f379200

Browse files
author
Eric Liu
committed
update to work on defang/AWS/GCP
1 parent a8d3d4b commit f379200

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Default .dockerignore file for Defang
2+
**/__pycache__
3+
**/.direnv
4+
**/.DS_Store
5+
**/.envrc
6+
**/.git
7+
**/.github
8+
**/.idea
9+
**/.next
10+
**/.vscode
11+
**/compose.*.yaml
12+
**/compose.*.yml
13+
**/compose.yaml
14+
**/compose.yml
15+
**/docker-compose.*.yaml
16+
**/docker-compose.*.yml
17+
**/docker-compose.yaml
18+
**/docker-compose.yml
19+
**/node_modules
20+
**/Thumbs.db
21+
Dockerfile
22+
*.Dockerfile
23+
# Ignore our own binary, but only in the root to avoid ignoring subfolders
24+
defang
25+
defang.exe
26+
# Ignore our project-level state
27+
.defang

samples/sveltekit-mongodb/app/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ RUN npm install
1818
# Copy the rest of the application code
1919
COPY . .
2020

21-
# Set environment variable for MongoDB URI
22-
ARG MONGODB_URI
23-
ENV MONGODB_URI=$MONGODB_URI
24-
2521
# Build the SvelteKit application
2622
RUN npm run build
2723

samples/sveltekit-mongodb/app/src/lib/db.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { MongoClient } from 'mongodb';
22

3-
const uri = process.env.MONGODB_URI || 'mongodb://localhost:27017/musicdb';
3+
const uri = process.env.MONGO_URL || 'mongodb://localhost:27017/musicdb';
4+
console.log(`Connecting to MongoDB at URL = ${uri}`);
45
const client = new MongoClient(uri);
56

67
let cachedClient = null;

samples/sveltekit-mongodb/compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ services:
44
build:
55
context: ./app
66
dockerfile: Dockerfile
7-
args:
8-
MONGODB_URI: "mongodb://mongo:27017/musicdb"
97
environment:
108
NODE_ENV: production
119
HOST: "0.0.0.0"
1210
PORT: 3000
13-
MONGODB_URI: "mongodb://mongo:27017/musicdb"
11+
MONGO_URL: "mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/musicdb?retryWrites=false&authMechanism=SCRAM-SHA-1&authSource=admin"
1412
ports:
1513
- "3000:3000"
1614
depends_on:
@@ -31,6 +29,8 @@ services:
3129
volumes:
3230
- mongo-data:/data/db
3331
environment:
32+
MONGO_INITDB_ROOT_USERNAME:
33+
MONGO_INITDB_ROOT_PASSWORD:
3434
MONGO_INITDB_DATABASE: musicdb
3535
#deploy:
3636
# resources:

0 commit comments

Comments
 (0)