From 2e6630eff9b344aa574c86bd45dfd12b339ed6e2 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Thu, 15 Apr 2021 17:35:28 -0400 Subject: [PATCH] Misc tweaks - Added some documentation finally - Implemented cpanfile - Cleaned up Dockerfile - Use prefork server instead of daemon --- Dockerfile | 33 ++++++++++++--------------------- README.md | 23 +++++++++++++++++++++++ cpanfile | 12 ++++++++++++ 3 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 cpanfile diff --git a/Dockerfile b/Dockerfile index 5d80bd7..9072130 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,28 @@ -FROM perl:5.32 - -# Dependency time -RUN apt-get update -RUN apt-get -y upgrade -RUN apt-get -y install fortune-mod ruby -RUN cpanm CGI -RUN cpanm CGI::Carp -RUN cpanm Mojolicious -RUN cpanm Mojolicious::Plugin::CGI -RUN cpanm Number::Format -RUN cpanm Regexp::Common -# Version 0.106 of Getopt::Long::Descriptive won't build for me; as -# it's just a dependency for WebService::Mattermost anyways let's just -# go with 0.105 since we know that works -RUN cpanm RJBS/Getopt-Long-Descriptive-0.105.tar.gz -RUN cpanm WebService::Mattermost -RUN cpanm XML::LibXML -RUN gem install cgi -RUN gem install ipaddress +FROM perl:5.32.1 # Move it WORKDIR /opt COPY cgi-bin/ ./cgi-bin/ COPY public/ ./public/ COPY templates/ ./templates/ +COPY cpanfile . COPY .mmCreds.xml . COPY .msg.bans . COPY .name.bans . COPY www-swagg.conf . COPY www-swagg.pl . +# Dependency time +RUN apt-get update +RUN apt-get -y upgrade +RUN apt-get -y install fortune-mod ruby +RUN cpanm --installdeps . +RUN gem install cgi +RUN gem install ipaddress + # Finish setting up the environment ENV MOJO_REVERSE_PROXY=1 +EXPOSE 3000 # Send it -CMD ["perl", "www-swagg.pl", "daemon", "-m", "production"] +CMD ["perl", "www-swagg.pl", "prefork", "-m", "production"] diff --git a/README.md b/README.md index f7301b3..e3c3b9e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ # www2.0 The successor to my homepage. Hold on to your butts. + +## Building/Testing + +### Build the container locally + + docker build -t www-swagg . + +### Run it locally + + docker run -p 3000:3000 www-swagg:latest + +Pull up [http://localhost:3000](http://localhost:3000) and poke around +**TODO:** Should create automated tests for this + +## Tagging/Pushing + +### Tag the image + + docker tag www-swagg gcr.io/www-swagg/www-swagg + +### Send it + + docker push gcr.io/www-swagg/www-swagg diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..25c4a1d --- /dev/null +++ b/cpanfile @@ -0,0 +1,12 @@ +requires 'CGI'; +requires 'CGI::Carp'; +requires 'Mojolicious'; +requires 'Mojolicious::Plugin::CGI'; +requires 'Number::Format'; +requires 'Regexp::Common'; +# Version 0.106 of Getopt::Long::Descriptive won't build for me; as +# it's just a dependency for WebService::Mattermost anyways let's just +# go with 0.105 since we know that works +requires 'Getopt::Long::Descriptive', '<= 0.105'; +requires 'WebService::Mattermost'; +requires 'XML::LibXML';