Skip to content

Commit c0031a2

Browse files
committed
updates readme to include containerized docs for frontend
1 parent 7d6be0d commit c0031a2

File tree

1 file changed

+102
-1
lines changed

1 file changed

+102
-1
lines changed

README.md

+102-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Refactor Coaching & Mentoring Platform
2-
### Frontend (currently web browser-only)
2+
3+
## Frontend (currently web browser-only)
34

45
![377960688-0b5292b0-6ec7-4774-984e-8e99e503d26c](https://github.com/user-attachments/assets/5dcdee09-802e-4b25-aa58-757d607ce7bc)
56
A preview of the main coaching session page (rapidly evolving)
@@ -43,3 +44,103 @@ npm run dev
4344

4445
Open [http://localhost:3000](http://localhost:3000) with your browser to log in to the platform.
4546

47+
---
48+
49+
## Managing the Project with Docker & GitHub Actions (CI/CD)
50+
51+
This project builds and pushes a multi-arch Docker image to [GHCR](https://ghcr.io/) automatically on pushes to branches with open pull requests.
52+
53+
**Key Steps:**
54+
55+
1. **Develop Your Changes:**
56+
- Work on your feature or fix in your branch.
57+
58+
2. **Open a Pull Request:**
59+
- When you open a PR, GitHub Actions triggers the build workflow.
60+
61+
3. **Automated Build & Push:**
62+
- The workflow builds a multi-arch Docker image and pushes it to GHCR.
63+
- Verify the build status in GitHub Actions.
64+
65+
4. **Local Testing (Optional):**
66+
- For local Docker testing, note that the Docker Compose file and environment variables are maintained in the backend repository. Make sure you have access to that repo for configuration details.
67+
68+
---
69+
70+
## Manual Docker Image Management
71+
72+
### If you plan on working with the Docker Image Locally as well the following section addresses acts as a quickstart guide for managing the Docker images manually
73+
74+
### Prerequisites
75+
76+
- Before running any Docker commands, ensure you are logged into GHCR using your GitHub personal access token (PAT):
77+
78+
```bash
79+
docker login ghcr.io -u <your_github_username> -p <your_PAT>
80+
```
81+
82+
- Ensure you have Containerd installed and running
83+
- Ensure you have Docker Buildx installed and configured
84+
- Ensure you are using the builder instance you create using steps 1-4 below
85+
- Ensure you have Docker installed and running
86+
**Image Naming Convention:**
87+
The Docker images follow the naming convention:
88+
`ghcr.io/refactor-group/refactor-platform-fe/<branch>:latest`
89+
90+
Where:
91+
92+
- `refactor-group` is your GitHub organization.
93+
- `refactor-platform-fe` is the repository name.
94+
- `<branch>` is the name of the branch, with underscores converted to dashes.
95+
- `latest` is the tag.
96+
97+
**Useful Commands:**
98+
99+
```bash
100+
# Docker Buildx: Enhanced Image Management
101+
102+
# 1. Inspect Docker Buildx
103+
docker buildx version # Verify Docker Buildx is installed
104+
105+
# 2. Create a new builder instance (if needed)
106+
docker buildx create --name mybuilder --driver docker-container # Creates a builder instance named 'mybuilder' using the docker-container driver
107+
108+
# 3. Use the builder
109+
docker buildx use mybuilder # Sets 'mybuilder' as the current builder
110+
111+
# 4. Inspect the builder
112+
docker buildx inspect --bootstrap # Displays details and ensures the builder is running
113+
114+
# 5. Login to GHCR
115+
docker login ghcr.io -u <your_github_username> -p <your_PAT> # Authenticates with GitHub Container Registry using your username and PAT
116+
117+
# 6. Build the image for multiple architectures and push to registry
118+
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/refactor-group/refactor-platform-fe:<branch> --push . # Builds for specified architectures and pushes to GHCR
119+
120+
# 7. Build the image for multiple architectures and load to local docker daemon
121+
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/refactor-group/refactor-platform-fe:<branch> --load . # Builds for specified architectures and loads to local docker daemon
122+
123+
# 8. Tag the image
124+
docker tag ghcr.io/refactor-group/refactor-platform-fe:<branch> ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Creates an additional tag 'latest' for the image
125+
126+
# 9. Push the image
127+
docker push ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Uploads the image to the container registry
128+
129+
# 10. Pull the image
130+
docker pull ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Downloads the image from the container registry
131+
132+
# 11. Run the image
133+
docker run -p 3000:3000 ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Starts a container from the image, mapping port 3000
134+
135+
# 12. Inspect the image
136+
docker inspect ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Shows detailed information about the image
137+
138+
# 13. Remove the image
139+
docker rmi ghcr.io/refactor-group/refactor-platform-fe:<branch>:latest # Deletes the image from the local machine
140+
```
141+
142+
### Important Notes
143+
144+
- Always use the `latest` tag for the most recent version (it defaults to `latest`)
145+
- Ensure your branch is up to date with the main branch before opening a PR
146+
- For backend-specific configuration (Docker Compose & env vars), refer to the backend repository documentation

0 commit comments

Comments
 (0)