Skip to content

Commit

Permalink
Live reload and SCSS compliation working in Docker Image
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Fishman committed Oct 9, 2024
1 parent 0a7cc05 commit ccb7d05
Show file tree
Hide file tree
Showing 17 changed files with 536 additions and 1,021 deletions.
46 changes: 35 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
# Start with a Python base image
FROM python:3.8-slim
FROM squidfunk/mkdocs-material

# Set a working directory
WORKDIR /app
#COPY . /app

# Copy the requirements.txt file into the image
COPY requirements.txt /app/
RUN apk add --no-cache nodejs npm

# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /docs

# Copy the rest of your MkDocs site source code into the image
COPY . /app/
COPY package.json .
RUN npm install


COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .

# Expose the port MkDocs will run on
EXPOSE 8000
EXPOSE 8000 35729


# Create a startup script
RUN echo '#!/bin/sh' > /start.sh && \
echo 'npm run watch-sass &' >> /start.sh && \
echo 'mkdocs serve --dev-addr 0.0.0.0:8000' >> /start.sh && \
chmod +x /start.sh

# Set the startup script as the entry point
ENTRYPOINT ["/start.sh"]

# Run MkDocs serve command
CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
# CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]

# Command to run both SCSS watcher and MkDocs serve concurrently
#CMD ["concurrently",
# "\"sass --watch components/sass/main.scss:components/sass/main.css\"",
# "\"mkdocs serve --dev-addr=0.0.0.0:8000\""]

#CMD ["concurrently",
# "\"/usr/local/bin/sass --watch docs/components/sass/main.scss:docs/components/sass/main.css\"",
# "\"mkdocs serve --dev-addr=0.0.0.0:8000\"",
# "\"python -m livereload docs -p 35729 -w docs\""]
1 change: 1 addition & 0 deletions components/sass/layout/grid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.btn-grid-3{display:grid;grid-template-columns:repeat(3, 1fr);text-align:center}.grid-items{border:1px solid #ccc;padding:20px;display:flex;align-content:center;justify-content:center}/*# sourceMappingURL=grid.css.map */
1 change: 1 addition & 0 deletions components/sass/layout/grid.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/sass/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/sass/main.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.9'
services:
mkdocs:
image: squidfunk/mkdocs-material
volumes:
- .:/docs
- .:/node_modules # Persist node_modules for faster subsequent builds
stdin_open: true
tty: true
command: mkdocs serve --dev-addr=0.0.0.0:8000
20 changes: 6 additions & 14 deletions docs/components/sass/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// --8<-- [start:btn]
.btn {
border: 0;
box-shadow: 0 0 8px 0 rgba($color-black, 0.2);
display: inline-block;
font-weight: map-get($font-weight, bold);
text-decoration: none;
Expand All @@ -37,21 +36,17 @@
/* Primary Button --- Green */

.btn {
background: $button-color;
background: $color-darkgreen;
color: $button-text-color;
border: 4px solid transparent;
gi

// &:link,
// &:visited {
// color: $color-white;
// }
&:focus,
&.focus {
border-color: $button-hovercolor;
outline-color: $button-hovercolor;
}
&:disabled {
background: #949494 !important;
&:disabled, &.disabled {
background: $color-dark-grey !important;
}
&:hover,
&:active,
Expand All @@ -66,15 +61,12 @@
color: $color-white !important;
}
}

.disabled {
background: #949494 !important;
}
// --8<-- [end:btn]

/*---------------------------
Button Sizes
---------------------------*/
// --8<-- [end:btn]


// --8<-- [start:btnSm]
.btn-sm {
Expand Down
Loading

0 comments on commit ccb7d05

Please sign in to comment.