Skip to content
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

writing dockerfile #48

Open
wants to merge 1 commit into
base: second-edition
Choose a base branch
from
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
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js runtime as a parent image
FROM node:18

# Set the working directory inside the container
WORKDIR /server

# Copy package.json and package-lock.json to install dependencies
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code to the container
COPY . .

# Expose the port your app runs on
EXPOSE 3000

# Start the application
CMD ["npm", "start"]
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

services:
app:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
- PORT=3000
- JWT_SECRET=process.env.JWT_SECRET
- MONGODB_URI=process.env.MONGODB_URI
- STRIPE_CONNECT_TEST_CLIENT_ID=your_stripe_connect_test_client
- STRIPE_TEST_SECRET_KEY=your_stripe_test_secret_key
- STRIPE_TEST_API_KEY=your_stripe_test_api_key
depends_on:
- mongo
networks:
- app-network
command: npm start

mongo:
image: mongo:4.4
volumes:
- mongo-data:/data/db
ports:
- "27017:27017"
networks:
- app-network

volumes:
mongo-data:

networks:
app-network:
Loading