diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3787f2e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# Ignore Astro files +*.astro + +# Ignore node_modules directory +node_modules/ + +# Ignore build output +dist/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..754c962 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Base stage for building the static files +FROM node:lts AS base +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# Runtime stage for serving the application +FROM nginx:mainline-alpine-slim AS runtime +COPY --from=base ./app/dist /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md index a46a9c2..eca4670 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Documentation can be read in two formats\_ _markdown_ & _blog post_. ## 👨🏻‍💻 Running Locally -The easiest way to run this project locally is to run the following command in your desired directory. +You can start using this project locally by running the following command in your desired directory: ```bash # npm 6.x @@ -118,6 +118,26 @@ yarn create astro --template satnaing/astro-paper pnpm dlx create-astro --template satnaing/astro-paper ``` +Then start the project by running the following commands: + +```bash +# prepare commit hook & install dependencies +npm run prepare && npm run install + +# start running the project +npm run dev +``` + +As an alternative approach, if you have Docker installed, you can use Docker to run this project locally. Here's how: + +```bash +# Build the Docker image +docker build -t astropaper . + +# Run the Docker container +docker run -p 4321:80 astropaper +``` + ## Google Site Verification (optional) You can easily add your [Google Site Verification HTML tag](https://support.google.com/webmasters/answer/9008080#meta_tag_verification&zippy=%2Chtml-tag) in AstroPaper using environment variable. This step is optional. If you don't add the following env variable, the google-site-verification tag won't appear in the html `` section. @@ -146,6 +166,8 @@ All commands are run from the root of the project, from a terminal: | `npm run lint` | Lint with ESLint | | `docker compose up -d` | Run AstroPaper on docker, You can access with the same hostname and port informed on `dev` command. | | `docker compose run app npm install` | You can run any command above into the docker container. | +| `docker build -t astropaper .` | Build Docker image for AstroPaper. | +| `docker run -p 4321:80 astropaper` | Run AstroPaper on Docker. The website will be accessible at `http://localhost:4321`. | > **_Warning!_** Windows PowerShell users may need to install the [concurrently package](https://www.npmjs.com/package/concurrently) if they want to [run diagnostics](https://docs.astro.build/en/reference/cli-reference/#astro-check) during development (`astro check --watch & astro dev`). For more info, see [this issue](https://github.com/satnaing/astro-paper/issues/113).