Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
node_modules
npm-debug
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:13.8.0-alpine3.11

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "node", "server.js" ]
6 changes: 3 additions & 3 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
remoteUrl : 'mongodb://node:[email protected]:27017/uwO3mypu',
localUrl: 'mongodb://localhost/meanstacktutorials'
};
remoteUrl : process.env.DB_CONN_STRING,
localUrl : process.env.DB_CONN_STRING
};
41 changes: 41 additions & 0 deletions kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo
spec:
replicas: 3
selector:
matchLabels:
app: todo
template:
metadata:
labels:
app: todo
spec:
containers:
- name: todo
image: codebabel/todo
ports:
- containerPort: 8080
env:
- name: DB_CONN_STRING
valueFrom:
secretKeyRef:
name: db-conn-string
key: key

---
apiVersion: v1
kind: Service
metadata:
name: todo-service
labels:
name: todo-service
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: todo
type: LoadBalancer
Loading