License MIT
This section provides instructions to build and run the application using Docker, suitable for an MVP deployment on a server like Contabo.
- Docker installed on your local machine and on the deployment server.
Navigate to the project's root directory (where the Dockerfile is located) and run:
docker build -t cityblog .Once the image is built, you can run it as a container:
docker run -d -p 80:3000 cityblogThis command runs the container in detached mode (-d) and maps port 80 on the host to port 3000 in the container. You can then access the application via http://your_server_ip. If you want to use a different host port, change 80 to your desired port (e.g., 8080:3000).
- Provision a VPS: Set up a Virtual Private Server (VPS) on Contabo with an operating system that supports Docker (e.g., Ubuntu).
- Install Docker: Connect to your VPS via SSH and install Docker by following the official Docker installation instructions for your chosen OS.
- Transfer Image or Dockerfile:
- Option A (Transfer Image): You can save your locally built Docker image (
docker save cityblog > cityblog.tar), transfercityblog.tarto your VPS (e.g., usingscp), and then load it on the VPS (docker load < cityblog.tar). - Option B (Build on Server): Transfer your project files (including the
Dockerfile) to the VPS (e.g., usinggit cloneorscp), and then build the Docker image directly on the server using thedocker buildcommand mentioned above.
- Option A (Transfer Image): You can save your locally built Docker image (
- Run the Container: Use the
docker runcommand on your VPS as shown above. - Firewall: Ensure your VPS firewall (if any, like
ufwon Ubuntu) allows incoming connections on the port you've mapped (e.g., port 80). - DNS (Optional): For a more professional setup, point a domain name to your server's IP address.