Skip to content

Commit 64c1cce

Browse files
authored
Deal with a range of system environment problems by docker and make it deploy easier (#1021)
* Deal with a range of system environment problems by docker and make it deploy easier ---------
1 parent af16f57 commit 64c1cce

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ To build the site, you need to go through a one-time installation
2424
procedure that takes 15 to 30 minutes. After that you can build the
2525
site an unlimited number of times with no extra work.
2626

27+
**[You also can choose to build the site locally by docker, click here to get a guide.](./docker.md)**
28+
2729
##### Install The Dependencies
2830

2931
**Install RVM**

docker.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[TOC]
2+
3+
- Ensure Docker is installed and running (https://docs.docker.com/desktop/)
4+
5+
## Building The Site Locally By Docker
6+
7+
1. Define the absolute parent path of repository bitcoinops.github.io .
8+
```bash
9+
repath=~/Desktop/
10+
```
11+
12+
2. Create the parent folder and go into the parent folder.
13+
```bash
14+
mkdir -p ${repath}
15+
cd ${repath}
16+
```
17+
18+
3. Download the repository bitcoinops.github.io .
19+
```bash
20+
git clone https://github.com/bitcoinops/bitcoinops.github.io
21+
```
22+
23+
4. Building the site.
24+
```bash
25+
# Some of the dependencies can take a long time to install on some systems, so be patient.
26+
docker run -d --name bitcoinops -p 4000:4000 -v ${repath}/bitcoinops.github.io:/root/bitcoinops.github.io -w /root/bitcoinops.github.io ruby:2.6.4-stretch /bin/bash -c "bundle install && make preview"
27+
```
28+
29+
5. Output the bitcoinops container log
30+
```bash
31+
docker logs -f bitcoinops
32+
```
33+
34+
6. The bitcoinops container prints a log like this if building the site is successful.
35+
```log
36+
Server address: http://0.0.0.0:4000/
37+
Server running... press ctrl-c to stop.
38+
```
39+
40+
6. Visit URL 127.0.0.1:4000 in your browser to view the site.
41+
42+
7. Edit files and save files, then refresh the site in a browser, the site will show the newest content.
43+
44+
## Basic Docker Command
45+
```bash
46+
# list all containers.
47+
docker ps -a
48+
49+
# list all running containers.
50+
docker ps
51+
52+
# start a container.
53+
containername=bitcoinops
54+
docker start ${containername}
55+
56+
# stop a container.
57+
containername=bitcoinops
58+
docker stop ${containername}
59+
60+
# output a container log.
61+
containername=bitcoinops
62+
docker logs -f ${containername}
63+
```

0 commit comments

Comments
 (0)