How to setup Docker with static HTML file


How to setup Docker with static HTML file

Are you ready to launch your static website with HTML, Docker and NginxProxyManager. Check this out and do it yourself pretty easy.

Dockerfile

FROM node:lts-alpine

# install simple http server for serving static content
RUN yarn global add serve

# make the 'app' folder the current working directory
WORKDIR /usr/src/website

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

EXPOSE 8080
CMD [ "serve", "-p", "8080"]

docker-compose.yml

version: "3.3"

services:
  ngxinxproxymanager:
    image: "jc21/nginx-proxy-manager:latest"
    container_name: yourproject-ngxinxproxymanager
    restart: unless-stopped
    ports:
      - "80:80" # Public HTTP Port
      - "443:443" # Public HTTPS Port
      - "81:81" # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    networks:
      - yourproject-network
    environment:
      # the SQLite DB file within the container
      DB_SQLITE_FILE: "/data/database.sqlite"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

  website:
    build:
      context: ../website
      dockerfile: ../docker/website.Dockerfile
    container_name: yourproject-website
    restart: always
    ports:
      - "8081:8080"
    networks:
      - yourproject-network

networks:
  yourproject-network:
    driver: bridge

volumes:
  yourproject-db:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: "${PWD}/db-data"


Related articles:

Newsletter


Related Posts

Tools for Analyzing Your Competition

Before knowing where your business stands, you should look at the market and your competition. You need to know what marketing tactics and strategies are working for your audience, what traffic the competition has, and how they position.

Free Online Photo Editor with Cool Effects | Edit Images Easily

Transform your images with our free online photo editor with cool effects. Add filters, adjust colors, and apply creative enhancements. Edit your photos easily and make them stand out.

How to find the size of a table in SQL?

Learn how to determine the size of a SQL table with this informative guide. Discover efficient methods for measuring table size.

MongoDB Query date by _id field

Query date by _id in mongodb. Straighforward guide to solve your issue right away.

Unleashing the Power of Free API for Scrape Reverse Geocoding

Learn how to harness the potential of reverse geocoding with our beginner's guide to scraping APIs for free. Unlock the power today.

Discover the Power of Whatsapp-web.js for Safe and Easy Automation

Automate WhatsApp with ease using Whatsapp-web.js, a NodeJS client library that connects through the official WhatsApp Web app, reducing ban risks. Perfect for user or business accounts.

Website tours js tools

Tools to create live tours for your web project using js libraries.

Unlocking SaaS Marketing Success: Essential Resources to Learn and Grow

Discover a comprehensive collection of valuable resources to master the art of SaaS marketing.

Where to launch your startup

Do you wanna launch grandiosely your startup? Get a list of platforms where people can discover your project and can push your project directly to the sky.

Email campaign improving my SaaS convertion - Manager Flota

Users subscribe to your SaaS, but don't let the money on your table. Here's how I do it!