Compare commits
4 Commits
main
...
i335_docke
| Author | SHA1 | Date | |
|---|---|---|---|
|
3cc4a6b5d3
|
|||
|
47b2c588b8
|
|||
|
5bdda3c1ef
|
|||
|
7cea36879c
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM perl:stable
|
||||
|
||||
RUN cpanm Config::Std \
|
||||
&& cpanm Template \
|
||||
&& cpanm Template::Plugin::DBI \
|
||||
&& cpanm Template::Plugin::HTML::Strip \
|
||||
&& cpanm DBD::SQLite \
|
||||
&& cpanm Tie::DBI \
|
||||
&& cpanm Date::Calc \
|
||||
&& cpanm Text::CSV_XS \
|
||||
&& cpanm HTML::Entities \
|
||||
&& mkdir -p /usr/src/app
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
ADD site-generator /usr/src/app/site-generator
|
||||
ADD site.cfg /usr/src/app/site.cfg
|
||||
ADD templates /usr/src/app/templates
|
||||
ADD LICENSE /usr/src/app/LICENSE
|
||||
|
||||
# Tell Perl where to find the local modules
|
||||
ENV PERL5LIB=/usr/local/lib/perl5/site_perl
|
||||
|
||||
ENTRYPOINT ["/usr/src/app/site-generator"]
|
||||
@@ -11,7 +11,9 @@ password are required), run:
|
||||
On success, an "hpr_generator" directory will be created in the folder from
|
||||
which the clone command was executed containing a local copy of the git repository.
|
||||
|
||||
# Install required Perl modules
|
||||
# Building on local system
|
||||
|
||||
## Install required Perl modules
|
||||
|
||||
Installing the Perl modules is the most finicky part of the installation process.
|
||||
The needed Perl modules can be found using the operating system's package
|
||||
@@ -34,7 +36,7 @@ apt install libconfig-std-perl \
|
||||
|
||||
```
|
||||
|
||||
## Using CPAN to install the modules
|
||||
### Using CPAN to install the modules
|
||||
|
||||
A cross platform method to install the needed modules is the Perl CPAN application.
|
||||
Make sure that the [gcc](https://www.gnu.org/software/gcc/),
|
||||
@@ -55,7 +57,7 @@ cpan Tie::DBI
|
||||
cpan Text:CSV_XS
|
||||
```
|
||||
|
||||
## Testing for Perl module dependencies
|
||||
### Testing for Perl module dependencies
|
||||
|
||||
A bash script is included in the utils directory that will list the Perl modules used by the site-generator and report whether the modules are installed on the current OS.
|
||||
|
||||
@@ -65,6 +67,37 @@ It can be run from any directory. To run from the utils directory:
|
||||
./check-dependencies.sh
|
||||
```
|
||||
|
||||
# Building with Docker
|
||||
|
||||
The docker file will copy the local version of the site-generator program, the templates directory, the LICENSE file,
|
||||
and the site.cfg file into the Docker image. For the docker image to run correctly it needs access to your local
|
||||
hpr.db file and the output directory (defaults to "public_html"). The default site.cfg assumes the hpr.db is located
|
||||
in the directory from which the site-generator is run. There are two ways to make the db available to the container:
|
||||
|
||||
* Put the hpr.db file in the public_html folder and modify the driver option under the [DBI] section of the site.cfg to:<br>
|
||||
```driver: dbi:SQLite:public_html/hpr.db```
|
||||
* mount the hpr.db file into the container when starting up the container with the -v option: <br>
|
||||
```-v <path to db directory>/hpr.db:/usr/src/app/hpr.db```
|
||||
|
||||
Build the image by running the following command from the hpr_generator directory:
|
||||
```docker run -t hpr/site-generator .```
|
||||
|
||||
The first build will take a while. It must pull down the base container, perl-latest, and then pull down and build the
|
||||
various Perl modules from CPAN. After the initial build, if you have modified your site.cfg file, templates dir, or the
|
||||
site-generator program itself, builds will be very quick.
|
||||
|
||||
## Running the container
|
||||
|
||||
When runing the Docker image, your local output directory (typically public_html) must be mounted into the container using
|
||||
the -v option. If you are using the default path for the hpr.db, then the local hpr.db file must also be mounted into the image.
|
||||
The following is an example of running the site-generator with default locations from the hpr_generator directory:
|
||||
```
|
||||
docker run \
|
||||
-v "$(pwd)/public_html":/usr/src/app/public_html \
|
||||
-v "$(pwd)/hpr.db":/usr/src/app/hpr.db \
|
||||
hpr/site-generator --help
|
||||
```
|
||||
|
||||
# Create the HPR database
|
||||
|
||||
The hpr_generator relies on information from a database to generate many of the
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
Static web page generator for the Hacker Public Radio website.
|
||||
|
||||
## Installation
|
||||
|
||||
### On local system
|
||||
|
||||
* Clone or download this repository
|
||||
* With SQLite
|
||||
* Create the sqlite3 database from the hpr.sql MySQL dump file available on
|
||||
@@ -31,6 +34,10 @@ Static web page generator for the Hacker Public Radio website.
|
||||
* Text::CSV_XS
|
||||
* HTML::Entities
|
||||
|
||||
### Using Docker
|
||||
|
||||
* run: `docker build -t hpr/site-generator .`
|
||||
|
||||
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
|
||||
installing the HPR generator.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# {{{ POD documentation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user