diff --git a/Dockerfile b/Dockerfile index ed9ac7892..9f3ea32f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,27 @@ +# Use Node 20 Alpine base image FROM node:20-alpine +# Set the working directory WORKDIR /app -COPY package*.json ./ +# Copy package files and Yarn config +COPY package*.json .yarnrc.yml yarn.lock ./ -RUN apk add --update git && \ +# Enable corepack (for yarn) +RUN corepack enable + +# Install git, initialize submodules, and install dependencies +RUN apk add --no-cache git && \ git init && \ git submodule init && \ git submodule update && \ - yarn + yarn install --immutable +# Copy all project files COPY . . +# Expose the dev server port EXPOSE 3000 -CMD yarn dev +# Start the development server +CMD ["yarn", "dev"] \ No newline at end of file diff --git a/INSTALLATION.md b/INSTALLATION.md index 55ee890d0..81fb4eb2a 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -266,23 +266,34 @@ git commit -m "commit message" --no-verify ### Run locally using Docker -If you are a Docker lover, you have the option to use it following these instructions. +If you prefer using Docker, you can build and run the development environment in a container. #### Prerequisites: - [Install Docker](https://docs.docker.com/get-docker/) -After cloning repository to your local, perform the following steps from the root of the repository. - #### Steps: -1. Build the Docker image: + +After cloning the repository, navigate to the `website` directory, where the `Dockerfile` is located. + +```bash +cd website +``` + +1. **Build the Docker image:** + + Run the following command to build the Docker image. This will create an image named `json-schema-website`. + ```bash - make install + docker build -t json-schema-website . ``` -2. Start the container: +2. **Run the Docker container:** + + This command starts the container, mapping port 3000 and mounting your local `website` directory for live code updates. + ```bash - make run + docker run --rm -p 3000:3000 -v "./:/app" json-schema-website ``` -Now you're running JSON Schema website in a development mode. Container is mapped with your local copy of the website. Whenever you make changes to the code, the website will refresh and changes visible in `http://localhost:3000`. +You can now access the website at `http://localhost:3000`. The development server is running in your terminal. To stop it, press `Ctrl+C`.