Docker Community Forums

Share and learn in the Docker community.

Do I need to include Nginx in my docker-compose?

docker

(Xandervolt) #1

Hello, I have an Express/Node/Mongo app that I’m developing on Windows, but plan to host in Ubuntu in production.

The Dockerfile for my app looks like…

FROM node:10

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "npm", "start" ]

My docker-compose file looks like this …

version: "3"
services:
  app:
    container_name: database
    restart: always
    build: .
    ports:
      - "8080:8080"
    links:
      - mongo
  mongo:
    container_name: mongo
    image: mongo
    volumes:
      - /data:/data/db
    ports:
      - "27017:27017"

I’m planning on deploying this to an Ubuntu digitalOcean droplet for production so I’ll have to use Nginx. Please let me know if I’m wrong, but it seems like I need to install Docker, and Nginx on the Ubuntu server, make sure the SSL is configured with Nginx, and then use docker for the Node/Express/Mongo part of the app?
Or is there some way I should be including Nginx in my docker compose as well?

Thank you for your help