Skip to content

Commit d494c73

Browse files
committed
Created building local capabilities
1 parent 008ae84 commit d494c73

File tree

6 files changed

+72
-39
lines changed

6 files changed

+72
-39
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_site
2+
.git

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ package.json
1212
.jekyll-cache
1313
spelling-results.txt
1414
linting-results.txt
15-
word_freq.txt
15+
word_freq.txt

assets/style.scss

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
---
33

44
//
5-
// IMPORTS
5+
// IMPORTS (all @use must be at the very top)
66
//
77

8-
@import "reset";
9-
@import "variables";
10-
// Syntax highlighting @import is at the bottom of this file
8+
@use "../_sass/_reset";
9+
@use "../_sass/_variables" as *;
10+
@use "../_sass/_darcula";
11+
@use "../_sass/_svg-icons";
12+
// Syntax highlighting partial is still commented out
13+
//@use "../_sass/_highlights";
14+
15+
@import url('https://fonts.googleapis.com/css?family=Roboto');
1116

1217
/**************/
1318
/* BASE RULES */
1419
/**************/
1520

16-
@import url('https://fonts.googleapis.com/css?family=Roboto');
17-
1821
html {
1922
font-size: 100%;
2023
height: 100%;
@@ -459,13 +462,13 @@ footer {
459462
}
460463

461464
body:after {
462-
    background: linear-gradient(to right, #ffffff 0, #2196F3 33%, #E91E63 66%, #000 100%);
463-
    width: 100%;
464-
    height: 5px;
465-
    top: 0;
466-
    position: absolute;
467-
    left: 0;
468-
    content: '';
465+
background: linear-gradient(to right, #ffffff 0, #2196F3 33%, #E91E63 66%, #000 100%);
466+
width: 100%;
467+
height: 5px;
468+
top: 0;
469+
position: absolute;
470+
left: 0;
471+
content: '';
469472
}
470473

471474
#bar {
@@ -860,7 +863,9 @@ Modules - reusable parts of our design
860863
margin-left: -30px;
861864
/* Force Hardware Acceleration in WebKit */
862865
-webkit-transform: translateZ(0);
866+
transform: translateZ(0);
863867
-webkit-backface-visibility: hidden;
868+
backface-visibility: hidden;
864869
}
865870
.cssanimations .cd-timeline-img.is-hidden {
866871
visibility: hidden;
@@ -1174,6 +1179,4 @@ Modules - reusable parts of our design
11741179

11751180
// Settled on moving the import of syntax highlighting to the bottom of the CSS
11761181
// ... Otherwise it really bloats up the top of the CSS file and makes it difficult to find the start
1177-
//@import "highlights";
1178-
@import "darcula";
1179-
@import "svg-icons";
1182+
//@use "../_sass/_highlights";

scripts/Dockerfile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
1-
FROM ruby:3.1
2-
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
3-
WORKDIR /usr/src/app
4-
COPY Gemfile ./
5-
RUN bundle install
1+
# Use official Ruby image
2+
FROM ruby:3.2
63

7-
EXPOSE 4000
4+
# Install dependencies
5+
RUN apt-get update -qq && \
6+
apt-get install -y build-essential libpq-dev nodejs && \
7+
rm -rf /var/lib/apt/lists/*
8+
9+
# Set workdir
10+
WORKDIR /srv/jekyll
11+
12+
# Accept build arg for Gemfile location
13+
ARG GEMFILE_DIR=scripts
14+
15+
# Copy Gemfile and Gemfile.lock from scripts
16+
COPY ${GEMFILE_DIR}/Gemfile* ./
17+
18+
RUN if [ -f Gemfile ]; then \
19+
gem install bundler && bundle install; \
20+
else \
21+
gem install jekyll bundler; \
22+
fi
23+
24+
# Copy the rest of the site (excluding scripts dir)
25+
COPY . .
26+
27+
# Default command
28+
CMD ["jekyll", "serve", "--host", "0.0.0.0"]

scripts/Gemfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
source 'https://rubygems.org'
2-
gem 'jekyll'
3-
gem 'webrick'
1+
source "https://rubygems.org"
2+
gem "jekyll"
3+
gem "jekyll-sitemap"
4+
gem "jekyll-feed"
5+
gem "jekyll-seo-tag"
6+
gem "jekyll-paginate"

scripts/build_locally.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
# Check if the path argument is provided
4-
if [ $# -eq 0 ]; then
5-
echo "Usage: $0 <path_to_directory>"
6-
exit 1
7-
fi
4+
IMAGE_NAME=jekyll-blog-local
85

9-
# Validate if the directory exists
10-
if [ ! -d "$1" ]; then
11-
echo "Error: Directory not found: $1"
12-
exit 1
13-
fi
6+
# Build the Docker image from scripts directory
7+
SCRIPT_DIR="$(dirname "$0")"
8+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
9+
10+
cd "$PROJECT_ROOT"
11+
12+
docker build -f scripts/Dockerfile -t $IMAGE_NAME --build-arg GEMFILE_DIR=scripts .
1413

15-
# Run the Docker command
16-
docker build -t marcusoftnet .
17-
docker run --rm --volume="$1:/usr/src/app" -it marcusoftnet jekyll build
14+
docker run --rm -v "$PROJECT_ROOT":/srv/jekyll -v "$PROJECT_ROOT/_site":/srv/jekyll/_site $IMAGE_NAME jekyll build
15+
16+
echo "✅ Jekyll site built in ./_site"
17+
18+
read -p "Do you want to serve the site locally? (y/n): " answer
19+
if [[ "$answer" =~ ^[Yy]$ ]]; then
20+
docker run --rm -p 4000:4000 $IMAGE_NAME
21+
fi

0 commit comments

Comments
 (0)