Skip to content

Commit b861f1d

Browse files
authored
Merge pull request #32 from weaponsforge/dev
v2.1.3
2 parents 8a3d60d + ea5318b commit b861f1d

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FROM base AS development
1515
RUN yarn install
1616
COPY . ./
1717
EXPOSE 3000
18-
CMD ["yarn", "dev"]
18+
CMD ["yarn", "dev:docker"]
1919

2020
# BUILD TARGET
2121
FROM base AS build

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Its development static hosting and file-serving architecture are closer to tradi
1919
- [Local-Built Development Image](#local-built-development-image)
2020
- [Building Docker Images](#building-docker-images)
2121
- [Deployment with GitHub Actions](#deployment-with-github-actions)
22+
- [Deployment URLs](#deployment-urls)
2223
- [Debugging Notes](#debugging-notes)
2324
- [Debugging Traditional Web Apps in VSCode](#debugging-traditional-webapps-in-vscode)
2425
- [References](#references)
@@ -72,9 +73,14 @@ These steps use **Node** and **Yarn** to run the development app.
7273

7374
Runs the Gulp and Browser-Sync tasks, launching the local website for development mode.
7475

76+
### `npm run dev:docker`
77+
78+
Sets the `IS_DOCKER=true` environment variable before running the Gulp and Browser-Sync tasks inside a Docker container. It doesn't launch the local website for development mode.
79+
> This command runs only in a Linux environment.
80+
7581
### `npm start`
7682

77-
Starts a simple ExpressJS web server serving the static website app from its static middleware.
83+
Runs a simple ExpressJS web server serving the static website app using its static middleware.
7884

7985
## Usage with Docker
8086

@@ -92,31 +98,33 @@ https://hub.docker.com/r/weaponsforge/livereload-basic
9298

9399
2. Run the development image.
94100
- Using only Docker (1st option):
95-
> **INFO:** This option requires having the static website development HTML, CSS and JavaScript files inside a `"/public"` directory, consisting of at least:
101+
> **INFO:** This option requires having the static website development HTML, CSS, and JavaScript files inside a `FILE_DIRECTORY` directory in the host machine. This example uses a `FILE_DIRECTORY` named `"/public"`, which contains at least:
96102

97103
```
98104
├─ my-website-project
99105
│ ├─ public
100106
│ ├─── index.html
101107
│ ├─── ...
102108
```
103-
Navigate to the website project directory (for example, `"my-website-project"`) using a terminal, then run:
109+
Navigate to the root project directory (for example, `"my-website-project"`) using a terminal, then run:
104110

105111
```
106112
# On Linux OS
107-
docker run -it --rm -p 3000:3000 -v $(pwd)/public:/opt/app/public -e IS_DOCKER=true weaponsforge/livereload-basic:latest
113+
docker run -it --rm -p 3000:3000 -v $(pwd)/FILE_DIRECTORY:/opt/app/public weaponsforge/livereload-basic:latest
108114

109115
# On Windows OS
110-
docker run -it --rm -p 3000:3000 -v %cd%\public:/opt/app/public -e USE_POLLING=true -e IS_DOCKER=true weaponsforge/livereload-basic:latest
116+
docker run -it --rm -p 3000:3000 -v %cd%\FILE_DIRECTORY:/opt/app/public -e USE_POLLING=true weaponsforge/livereload-basic:latest
111117
```
112118

119+
> _**TIP:**<br>
120+
> Replace `-p 3000:3000` with other port bindings as needed._
121+
113122
- Using Docker compose (2nd option):<br>
114123
- `docker compose -f docker-compose.dev.yml up`
115124
- > **INFO:** Uncomment the following lines in the `docker-compose.dev.yml` file when working in a Windows host.
116125
```
117-
# Enable USE_POLLING if working in Windows WSL2 to enable hot reload
126+
# Enable USE_POLLING if working in Windows WSL2 to enable live reload
118127
environment:
119-
- IS_DOCKER=true
120128
- USE_POLLING=true
121129
```
122130
3. Refer to the [Usage](#usage) section steps **# 2 - # 4** for local development.
@@ -169,6 +177,15 @@ Add the following GitHub Secrets and Variables to enable deployment to Docker Hu
169177
| --- | --- |
170178
| DOCKERHUB_USERNAME | (Optional) Docker Hub username. Required to enable pushing the development image to Docker Hub. |
171179

180+
## Deployment URLs
181+
182+
**Docker Hub**<br>
183+
https://hub.docker.com/r/weaponsforge/livereload-basic
184+
185+
**Live Preview (Sample Website)**<br>
186+
https://weaponsforge.github.io/livereload-basic/
187+
188+
172189
## Debugging Notes
173190

174191
<details>
@@ -232,4 +249,4 @@ Add the following GitHub Secrets and Variables to enable deployment to Docker Hu
232249

233250
@weaponsforge<br>
234251
20200630<br>
235-
20241006
252+
20241008

docker-compose.dev.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ services:
1212
ports:
1313
- "3000:3000"
1414
- "9229:9229"
15-
# Enable USE_POLLING if working in Windows WSL2 to enable hot reload
16-
environment:
17-
- IS_DOCKER=true
15+
# Enable USE_POLLING if working in Windows WSL2 to enable live reload
16+
# environment:
1817
# - USE_POLLING=true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"scripts": {
1111
"start": "node server.js",
12-
"dev": "./node_modules/.bin/gulp dev"
12+
"dev": "./node_modules/.bin/gulp dev",
13+
"dev:docker": "set IS_DOCKER=true && npm run dev"
1314
},
1415
"keywords": [
1516
"gulp",

0 commit comments

Comments
 (0)