Skip to content

Commit

Permalink
aider: Create Dockerfile and scripts to build and run the Jekyll site…
Browse files Browse the repository at this point in the history
… locally using Docker.

# Aider chat conversation:

USER: i want to render my github pages jekyll site locally. in the scripts/ dir, make me a dockerfile and scripts to build and run it.

ASSISTANT: To render your GitHub Pages Jekyll site locally using Docker, we need to create a Dockerfile and two scripts: one to build the Docker image and another to run the container.

Here are the necessary files:

1. `scripts/Dockerfile`
2. `scripts/build.sh`
3. `scripts/run.sh`

Let's create these files:

scripts/Dockerfile
```python
<<<<<<< SEARCH
=======
# Use the official Jekyll image from Docker Hub
FROM jekyll/jekyll:latest

# Set the working directory
WORKDIR /srv/jekyll

# Copy the current directory contents into the container at /srv/jekyll
COPY . /srv/jekyll

# Install any needed packages specified in Gemfile
RUN bundle install

# Expose port 4000 to the host
EXPOSE 4000

# Run Jekyll server
CMD ["jekyll", "serve", "--host", "0.0.0.0"]
>>>>>>> REPLACE
```

scripts/build.sh
```python
<<<<<<< SEARCH
=======
#!/bin/bash

# Build the Docker image
docker build -t my-jekyll-site -f scripts/Dockerfile .
>>>>>>> REPLACE
```

scripts/run.sh
```python
<<<<<<< SEARCH
=======
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 my-jekyll-site
>>>>>>> REPLACE
```

These scripts will allow you to build and run your Jekyll site locally using Docker. To use them, navigate to your project directory and run:

```sh
bash scripts/build.sh
bash scripts/run.sh
```

This will build the Docker image and start a container that serves your Jekyll site on `http://localhost:4000`.
  • Loading branch information
paul-gauthier committed May 15, 2024
1 parent 547a07f commit 2334860
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use the official Jekyll image from Docker Hub
FROM jekyll/jekyll:latest

# Set the working directory
WORKDIR /srv/jekyll

# Copy the current directory contents into the container at /srv/jekyll
COPY . /srv/jekyll

# Install any needed packages specified in Gemfile
RUN bundle install

# Expose port 4000 to the host
EXPOSE 4000

# Run Jekyll server
CMD ["jekyll", "serve", "--host", "0.0.0.0"]
4 changes: 4 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Build the Docker image
docker build -t my-jekyll-site -f scripts/Dockerfile .
4 changes: 4 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Run the Docker container
docker run --rm -v "$PWD:/srv/jekyll" -p 4000:4000 my-jekyll-site

0 comments on commit 2334860

Please sign in to comment.