Skip to content

Commit 39e26d2

Browse files
Joshua FishmanJoshua Fishman
authored andcommitted
docker cleanup and setup improvements
- Remove obsolete version attribute from docker-compose.yml - Simplify Docker setup to use docker compose up command - Update README with Docker-first approach and clear instructions - Update CONTRIBUTING.md with proper Docker commands and workflow - Enhance package.json with better development scripts - Improve entrypoint.sh with initial Sass build and clear logging - Add comprehensive documentation for live reload functionality
1 parent 21215f6 commit 39e26d2

File tree

6 files changed

+192
-125
lines changed

6 files changed

+192
-125
lines changed

CONTRIBUTING.md

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
- [**Prerequisites**](#prerequisites)
1212
- [**Setup Instructions**](#setup-instructions)
1313
- [1. Fork and Clone this repository](#1-fork-and-clone-this-repository)
14-
- [2. Install Dependencies](#2-install-dependencies)
15-
- [3. Docker Setup](#3-docker-setup)
16-
- [4. Starting Docker](#4-starting-docker)
17-
- [5. Stopping Docker](#5-stopping-docker)
18-
- [Docker Notes](#docker-notes)
14+
- [2. Starting the Development Environment](#2-starting-the-development-environment)
15+
- [3. Stopping Docker](#3-stopping-docker)
16+
- [4. Development Workflow](#4-development-workflow)
17+
- [Docker Development Notes](#docker-development-notes)
1918
- [**Working on issues**](#working-on-issues)
2019
- [**Branch Workflow**](#branch-workflow)
2120
- [**Create an issue**](#create-an-issue)
@@ -67,33 +66,74 @@
6766
upstream https://github.com/hackforla/internship-website-design-system.git (push)
6867
```
6968

70-
#### 1. **Docker Setup**
71-
- #### **Enter repo directory:**
69+
#### 2. **Starting the Development Environment**
70+
71+
**IMPORTANT:** Make sure **Docker Desktop** is running on your computer before executing the commands below.
72+
73+
- #### **Navigate to the project directory:**
7274
```bash
7375
cd internship-website-design-system
7476
```
75-
- #### **Build the Docker image:**
76-
```bash
77-
docker build -t ds .
77+
78+
- #### **Start the development environment:**
79+
```bash
80+
docker compose up
7881
```
79-
This command builds a Docker image named `ds` from the Dockerfile in the current directory.
80-
Note: If you have a permissions error run `sudo docker build -t ds .` and enter your machine's admin password.
82+
This command will:
83+
- Build the Docker image automatically
84+
- Install all npm dependencies
85+
- Compile Sass files initially
86+
- Start the Sass watcher for live CSS compilation
87+
- Start MkDocs server with live reload
88+
- Set up file watching for automatic updates
89+
90+
- #### **View the site:**
91+
Open your browser and navigate to: **http://localhost:8000**
8192

82-
#### 2. **Starting Docker**
83-
**IMPORTANT:** Please make sure the `Docker Desktop` application is **running on your computer** before you run the bash commands below.
84-
- #### Run the Docker container.
93+
Both Sass changes and documentation changes will automatically reload in your browser.
94+
95+
- #### **Alternative Docker Commands:**
8596
```bash
86-
docker run -p 8000:8000 -v $(pwd):/docs ds
97+
# Start in background (detached mode)
98+
docker compose up -d
99+
100+
# Build fresh and start
101+
docker compose up --build
102+
103+
# View logs while running in background
104+
docker compose logs -f
105+
106+
# Check container status
107+
docker compose ps
87108
```
88-
This command runs the `ds` image as a container and maps the container's port 8000 to port 8000 on your host machine, allowing you to access the MkDocs server. View the site by navigating to `[http://localhost:8000](http://0.0.0.0:8000/internship-website-design-system/)` in your web browser. You should see your MkDocs site being served from the Docker container.
89109

90-
#### 5. **Stopping Docker**
91-
Simply press `CTRL + C` in the terminal where the container is running. This sends a SIGINT signal, initiating a graceful shutdown of the container. If it doesn't stop, pressing `CTRL + C` again forces a more abrupt termination.
110+
#### 3. **Stopping Docker**
111+
- **If running in foreground:** Press `Ctrl + C` in the terminal
112+
- **If running in background:** Run `docker compose down`
92113

93-
#### Docker Notes:
114+
#### 4. **Development Workflow**
115+
116+
1. **Edit Sass files** in `docs/components/sass/`
117+
2. **Changes auto-compile** and browser refreshes automatically
118+
3. **Edit documentation** in `docs/*.md` files
119+
4. **Changes auto-reload** in the browser
120+
121+
#### Docker Development Notes:
94122

95-
- Changes to any files will automatically be displayed in your browser if the Docker image is ran with `docker run -p 8000:8000 -v $(pwd):/docs ds` as previously mentioned.
96-
- If the default port (8000) is already in use on your machine, you can map the container's port to a different port on your host machine by changing the first `8000` in the `docker run` command to a free port, e.g., `docker run -p 8001:8000 ds`.
123+
- **Live reload works for both CSS and documentation** - no manual refresh needed
124+
- **File changes are instant** - the container watches your local files
125+
- **Port 8000** serves the MkDocs site, **port 35729** handles live reload
126+
- **If port 8000 is busy:** Stop other services using that port or change the port mapping in `docker-compose.yml`
127+
- **Container commands:** If you need to run commands inside the container:
128+
```bash
129+
# Access container shell
130+
docker compose exec mkdocs sh
131+
132+
# Inside container you can run:
133+
npm run dev # Start only Sass watcher
134+
npm run build-sass # Build Sass once
135+
npm run clean # Clean compiled CSS
136+
```
97137

98138
## Working on issues
99139

@@ -145,7 +185,7 @@ After pushing your branch to your fork, navigate to the [original repository](ht
145185
## Testing
146186
<!-- Talk about Accessibility Testing -->
147187

148-
- Run and view the site locally. See [Starting Docker](#3-starting-docker)
188+
- Run and view the site locally. See [Starting the Development Environment](#2-starting-the-development-environment)
149189
- Observe visual changes for desktop-sized screens as well as mobile.
150190

151191
### Automated Accessibility Testing

README.md

Lines changed: 106 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,128 @@
22

33
This design system is a project of _Hack for LA_. It helps teams customize and develop their websites and applications. This design system is meant to provide necessary web components and make them easy to customize.
44

5-
It runs on Docker like so:
5+
## 🚀 Quick Start
6+
7+
### Start Development (Docker)
8+
9+
1. **Clone the repository:**
10+
```bash
11+
git clone https://github.com/hackforla/internship-website-design-system.git
12+
cd internship-website-design-system
13+
```
14+
15+
2. **Start the development environment:**
16+
```bash
17+
docker-compose up
18+
```
19+
This automatically:
20+
- Installs all dependencies
21+
- Compiles Sass files
22+
- Starts Sass watcher for live CSS compilation
23+
- Starts MkDocs server with live reload
24+
- Sets up file watching for changes
25+
26+
3. **Open your browser:**
27+
- Visit: http://localhost:8000
28+
- Both Sass changes and documentation changes will auto-reload
29+
30+
4. **Stop development:**
31+
```bash
32+
# Press Ctrl+C in the terminal, or:
33+
docker-compose down
34+
```
35+
36+
### Alternative Docker Commands
37+
638
```bash
7-
docker run -p 8000:8000 -v ${PWD}:/app mkdocs-site
39+
# Build and start fresh
40+
docker-compose up --build
41+
42+
# Run in background
43+
docker-compose up -d
44+
45+
# View logs
46+
docker-compose logs -f
47+
48+
# Stop background process
49+
docker-compose down
850
```
951

10-
### Wiki
52+
## 🛠️ Development Workflow
1153

12-
For more information on contributing
13-
[Software Engineer Wiki](https://github.com/hackforla/internship/wiki/Software-Engineer)
54+
1. **Edit Sass files** in `docs/components/sass/`
55+
2. **Changes auto-compile** and browser auto-refreshes
56+
3. **Edit documentation** in `docs/*.md` files
57+
4. **Changes auto-reload** in browser
58+
59+
### Internal Commands (Run Inside Container)
60+
61+
If you need to run commands inside the container:
62+
63+
```bash
64+
# Access container shell
65+
docker-compose exec mkdocs sh
66+
67+
# Inside container, you can run:
68+
npm run dev # Start only Sass watcher
69+
npm run build-sass # Build Sass once
70+
npm run clean # Clean compiled CSS
71+
npm run build # Build for production
72+
```
73+
74+
## 📁 Project Structure
75+
76+
```
77+
docs/
78+
├── components/sass/ # Source Sass files
79+
│ ├── main.scss # Main entry point
80+
│ ├── abstracts/ # Variables, mixins
81+
│ ├── components/ # Button, form components
82+
│ └── layout/ # Grid, tabs
83+
├── dist/ # Compiled CSS (auto-generated)
84+
│ └── main.css # Output CSS file
85+
└── *.md # Documentation pages
86+
```
87+
88+
## 🎨 Working with Styles
89+
90+
1. **Edit Sass files** in `docs/components/sass/`
91+
2. **Changes auto-compile** when Docker is running
92+
3. **Browser auto-refreshes** to show your changes
93+
4. **Compiled CSS** appears in `docs/dist/main.css`
94+
95+
## 🐳 Docker Setup Details
96+
97+
The Docker setup includes:
98+
- **Node.js & npm** for Sass compilation
99+
- **Python & pip** for MkDocs
100+
- **Live reload** for both CSS and documentation
101+
- **Volume mounting** for instant file changes
102+
- **Port forwarding** (8000 for site, 35729 for live reload)
14103

15104
### Technology used
16105

17-
- [GitHub Pages](https://pages.github.com/)
18-
- [Jekyll](https://jekyllrb.com/docs/)
19-
- [MK Docs](https://www.mkdocs.org/)
20-
- [Material for MK Docs](https://squidfunk.github.io/mkdocs-material/)
106+
- [MK Docs](https://www.mkdocs.org/) with [Material theme](https://squidfunk.github.io/mkdocs-material/)
21107
- [SASS](https://sass-lang.com/)
22-
- [Docker](https://docker.com)
108+
- [Docker](https://docker.com) & Docker Compose
109+
- [GitHub Pages](https://pages.github.com/) for deployment
23110

24-
<!-- Explain the different ways people can contribute. For example: -->
111+
## 🤝 Contributing
25112

113+
- [How to Contribute](CONTRIBUTING.md)
26114
- This is a project of _Hack for LA_, please [join here](https://www.hackforla.org/join)
27-
- Join the team on Slack on [#internship](https://hackforla.slack.com/archives/C01VAUPU788)
28-
29-
# Contributing
115+
- Join the team on Slack: [#internship](https://hackforla.slack.com/archives/C01VAUPU788)
30116

31-
- [How to Contribute](CONTRIBUTING.md)
117+
## 🔗 Links
32118

33-
# Contact info
119+
### Wiki
120+
[Software Engineer Wiki](https://github.com/hackforla/internship/wiki/Software-Engineer)
34121

35-
- Message the team on Slack: [#internship](https://hackforla.slack.com/archives/C01VAUPU788)
122+
### Contact info
123+
Message the team on Slack: [#internship](https://hackforla.slack.com/archives/C01VAUPU788)
36124

37125
### Licensing
38-
39126
[GPL-2.0 license](https://github.com/hackforla/internship-website-design-system#GPL-2.0-1-ov-file)
40127

128+
---
41129
_this readme file sourced from [Jessica Sand](http://jessicasand.com/other-stuff/just-enough-docs/)_

docker-compose.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.9'
21
services:
32
mkdocs:
43
build: .
@@ -10,7 +9,5 @@ services:
109
- "35729:35729"
1110
stdin_open: true
1211
tty: true
13-
command: mkdocs serve --dev-addr=0.0.0.0:8000
14-
watch:
15-
- action: rebuild
16-
path: package.json
12+
# Override the default command to ensure both Sass and MkDocs run
13+
command: sh -c "npm run dev & mkdocs serve --dev-addr=0.0.0.0:8000 --livereload"

entrypoint.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
#!/bin/sh
22

3+
# Ensure Sass is compiled initially
4+
echo "Building Sass files..."
5+
npm run build-sass
6+
7+
# Start Sass watcher in background
8+
echo "Starting Sass watcher..."
39
npm run dev &
4-
mkdocs serve --dev-addr=0.0.0.0:8000
10+
11+
# Start MkDocs with live reload
12+
echo "Starting MkDocs server with live reload..."
13+
mkdocs serve --dev-addr=0.0.0.0:8000 --livereload

0 commit comments

Comments
 (0)