Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KassiesRecipies

KassiesRecipies is a web application built using Next.js that allows users to explore and manage recipes. This README will guide you through setting up the project, running it in development mode, building the production version, deploying the app using Docker, and creating and transferring a Docker image tarball.

Table of Contents

  1. Prerequisites
  2. Setting Up the Development Environment
  3. Running the Development Server
  4. Building the Production Version
  5. Deploying the App Using Docker
    1. Building the Docker Image
    2. Running the Docker Container
  6. Creating and Transferring a Docker Image Tarball
    1. Building the Image
    2. Saving the Image as a Tarball
    3. Loading and Running the Image
  7. Environment Variables

Prerequisites

Before you start, make sure you have the following installed on your system:

  • Node.js (v22 or higher)
  • Docker (for containerization)
  • MongoDB (if you're running the database locally)

Setting Up the Development Environment

  1. Clone the repository:

    git clone git@github.com:VilSoft/KassiesRecipies.git
    cd KassiesRecipies
  2. Install dependencies:

    npm install
  3. Create a .env.local file in the root of the project and configure your environment variables (e.g., MongoDB connection string, etc.).

Testing

npm run test

Running the Development Server

To run the app in development mode, use the following command:

npm run dev

This will start the development server at http://localhost:3000. You can open this URL in your browser to view the app.

Building the Production Version

To build the production version of the app, run:

npm run build

This command generates the .next directory, which contains the optimized version of the app. After building, you can run the production version with:

npm run start

This will start the app in production mode at http://localhost:3000.

Deploying the App Using Docker

Building the Docker Image

  1. Build the Docker image for the app:

    docker build -t kassiesrecipies:latest .

    This will create a Docker image named kassiesrecipies:latest.

Running the Docker Container

  1. Run the app as a Docker container:

    docker run -p 3000:3000 kassiesrecipies:latest

    The app will be available at http://localhost:3000 within the container.

Creating and Transferring a Docker Image Tarball to a Resberry Pi

Building the Image

  1. Build the Docker image targeting the linux/arm64/v8 architecture (for Raspberry Pi):

    docker buildx build --platform linux/arm64/v8 -t kassiesrecipies:latest --load .

Saving the Image as a Tarball

  1. Save the image as a tarball for transfer:

    docker save -o kassiesrecipies-arm64.tar kassiesrecipies:latest

    This will generate the kassiesrecipies-arm64.tar file.

Loading and Running the Image

  1. Transfer the tarball to your Raspberry Pi:

    scp kassiesrecipies-arm64.tar pi@<your-pi-ip>:/home/pi/
  2. SSH into your Raspberry Pi:

    ssh pi@<your-pi-ip>
  3. Load the Docker image:

    docker load -i /home/pi/kassiesrecipies-arm64.tar
  4. Run the app as a Docker container on the Raspberry Pi:

    docker run --network host -p 3000:3000 --restart always kassiesrecipies:latest

    The --restart always will ensure that the container will start on boot/crash

The app will be available at http://localhost:3000 on your Raspberry Pi.

Environment Variables

Make sure to configure the following environment variables in your .env.local file:

  • MONGODB_URI: MongoDB connection string (e.g., mongodb://localhost:27017/yourdb).

Conclusion

This guide covered the basic steps for setting up the development environment, building the app for production, deploying it with Docker, and transferring the Docker image as a tarball for deployment on a Raspberry Pi. You should now be able to run the app locally and on your Pi with ease.

Let me know if you need further assistance or run into any issues!

About

A collection of recipies with easy conversions

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages