Skip to content

Commit

Permalink
Add docker (#14)
Browse files Browse the repository at this point in the history
* Create docker file

* Update package json

* Create docker compose yml
  • Loading branch information
supuna97 authored Oct 17, 2023
1 parent f4354ef commit c32c5c0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
20 changes: 20 additions & 0 deletions devops/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js runtime as the base image
FROM node:14

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install project dependencies
RUN npm install

# Copy the rest of your application's source code into the container
COPY . .

# Expose the port your Express application listens on (e.g., 3000)
EXPOSE 3030

# Start your application
CMD ["npm", "start"]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
app:
build:
context: ./devops/docker
dockerfile: Dockerfile
ports:
- '3030:80'
volumes:
- .:/app
environment:
NODE_ENV: development
command: npm start
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "express_js_crud_operation_apis",
"version": "1.0.0",
"description": "NodeJS Express Crud operations REST APIs with MVC Design pattern and Mysql.",
"main": "index.js",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "source .env; nodemon ..."
},
Expand Down

0 comments on commit c32c5c0

Please sign in to comment.