From 80f7dbf0ff26b7aa938ef03c0d24e5d5b76b6eed Mon Sep 17 00:00:00 2001 From: Janos <86970079+janosdebugs@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:44:06 +0100 Subject: [PATCH] Adding build container (#220) This commit adds a build container to make it easier for people without NodeJS/npm to run the website locally. Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com> --- Dockerfile | 8 ++++++++ README.md | 35 +++++++++++++++++++++++++++-------- docker-compose.yaml | 11 +++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..55e1eb6a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:18 + +WORKDIR /work +COPY package.json /work +COPY package-lock.json /work +RUN npm i + +CMD ["npm", "run", "start", "--", "--host","0.0.0.0"] diff --git a/README.md b/README.md index 4bd75c55..6104d116 100644 --- a/README.md +++ b/README.md @@ -8,29 +8,48 @@ - TypeScript - Tailwind CSS -## Getting Started +## Working with this repository -1. Clone the repository +### Cloning the repository + +This repository uses git submodules to pull in the [main OpenTofu repository](https://github.com/opentofu/opentofu). +You can clone it using the following two steps: + +1. Clone the repository: ```bash git clone git@github.com:opentofu/opentofu.org.git ``` -2. Install dependencies +2. Fetch the documentation: ```bash -npm i +git submodule init +git submodule update ``` -3. Fetch the documentation +### Running the dev server locally + +You can run the dev server if you have a local NodeJS/npm environment installed: + +1. Install dependencies: ```bash -git submodule init -git submodule update +npm i ``` -4. Start the development server +2. Start the development server: ```bash npm run start ``` + +You can now access the site locally at http://localhost:3000/ + +### Running the dev server in a container + +You can also run the dev server in a container with the following command: + +```bash +docker compose up --build +``` diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..62bf6175 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: '3.8' +services: + website: + build: . + volumes: + - source: ./ + target: /work + type: bind + - /work/node_modules + ports: + - "3000:3000"