Skip to content

fix(docker): Resolve build failure and clarify documentation #1783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
27 changes: 19 additions & 8 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Loading