From 7e076473ef85536ad8152c958d6e27009360d83e Mon Sep 17 00:00:00 2001 From: Harsha Goli Date: Mon, 4 Mar 2024 20:54:24 -0500 Subject: [PATCH 1/3] New dockerfile and docker-compose --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ docker-compose.yml | 11 +++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..9ab77d1fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Use an official Ruby runtime as a parent image +FROM ruby:2.6.4 + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Clone the bitcoinops.github.io repository +RUN git clone https://github.com/bitcoinops/bitcoinops.github.io.git + +# Change to the repository directory +WORKDIR /usr/src/app/bitcoinops.github.io + +# Install program to configure locales +RUN apt-get update +RUN apt-get install -y locales +RUN dpkg-reconfigure locales && \ + locale-gen C.UTF-8 && \ + /usr/sbin/update-locale LANG=C.UTF-8 + +# Install needed default locale for Makefly +RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \ + locale-gen + +# Set default locale for the environment +ENV LC_ALL C.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# Install any needed gems specified in Gemfile +RUN bundle install + +# Make port 4000 available to the world outside this container +EXPOSE 4000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..2aea5e55f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' + +services: + bitcoinops: + build: . + ports: + - "4000:4000" + volumes: + - .:/usr/src/app + working_dir: /usr/src/app + command: /bin/bash From 873115fd16a0fd071748a6836d34861be6027867 Mon Sep 17 00:00:00 2001 From: Harsha Goli Date: Mon, 4 Nov 2024 11:19:51 -0500 Subject: [PATCH 2/3] Reduced docker setup need, moved remainder to README --- README.md | 13 ++++++++++-- docker.md | 63 ------------------------------------------------------- 2 files changed, 11 insertions(+), 65 deletions(-) delete mode 100644 docker.md diff --git a/README.md b/README.md index 81349327d..0e3bed90c 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,20 @@ contact us at [info@bitcoinops.org](mailto:info@bitcoinops.org). ## Building The Site Locally -To build the site, you need to go through a one-time installation +To build the site without docker, you need to go through a one-time installation procedure that takes 15 to 30 minutes. After that you can build the site an unlimited number of times with no extra work. -**[You also can choose to build the site locally by docker, click here to get a guide.](./docker.md)** +**Docker** + +Ensure docker and docker-compose are installed. Run the command in the project +directory. + + docker-compose up --build + +To restart (in the event of code change). + + docker-compose down -v && docker-compose up --build ##### Install The Dependencies diff --git a/docker.md b/docker.md deleted file mode 100644 index 789e04f3a..000000000 --- a/docker.md +++ /dev/null @@ -1,63 +0,0 @@ -[TOC] - -- Ensure Docker is installed and running (https://docs.docker.com/desktop/) - -## Building The Site Locally By Docker - -1. Define the absolute parent path of repository bitcoinops.github.io . - ```bash - repath=~/Desktop/ - ``` - -2. Create the parent folder and go into the parent folder. - ```bash - mkdir -p ${repath} - cd ${repath} - ``` - -3. Download the repository bitcoinops.github.io . - ```bash - git clone https://github.com/bitcoinops/bitcoinops.github.io - ``` - -4. Building the site. - ```bash - # Some of the dependencies can take a long time to install on some systems, so be patient. - 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" - ``` - -5. Output the bitcoinops container log - ```bash - docker logs -f bitcoinops - ``` - -6. The bitcoinops container prints a log like this if building the site is successful. - ```log - Server address: http://0.0.0.0:4000/ - Server running... press ctrl-c to stop. - ``` - -6. Visit URL 127.0.0.1:4000 in your browser to view the site. - -7. Edit files and save files, then refresh the site in a browser, the site will show the newest content. - -## Basic Docker Command -```bash -# list all containers. -docker ps -a - -# list all running containers. -docker ps - -# start a container. -containername=bitcoinops -docker start ${containername} - -# stop a container. -containername=bitcoinops -docker stop ${containername} - -# output a container log. -containername=bitcoinops -docker logs -f ${containername} -``` \ No newline at end of file From 4c107a17b2d19fe74a998d8adbb576d534abe393 Mon Sep 17 00:00:00 2001 From: Harsha Goli Date: Mon, 4 Nov 2024 11:21:17 -0500 Subject: [PATCH 3/3] Update to deploy server --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2aea5e55f..83114e8ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,4 @@ services: volumes: - .:/usr/src/app working_dir: /usr/src/app - command: /bin/bash + command: make preview