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
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js image as our base image
From node:18-alpine

# Set the working directory in the container
WORKDIR /usr/src/app

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

# Install dependencies in the container
RUN npm install

# Copy the rest of the application to the working directory
COPY . .

# Expose the port the app will run on
EXPOSE 4000

# Command to run the applicaiton
CMD ["npm", "run", "server"]
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# server

## Running with Docker
1. **Build the Dokcker Image**: Build the Docker image locally.

```bash
docker build -t notify-med-server:latest .
```

2. **Run the Docker Container**:
After building th image, you can run the application in a container .

```bash
docker run \
-p 4000:4000 \
-e MONGO_URI=mongodb://your-database-ip/NotifyMEd \
-d \
server-app:latest
```

3. Access the application on `http://localhost:4000`.

## Environmental variables

You can also pass other environmenetal variabbles usinf the `-e` flag with docker run. For example, to set `JWT_SECRET`, you can add `-e JWT_SECRET=your_secret_here` to the `docker run` command.