Misc tweaks

- Added some documentation finally
- Implemented cpanfile
- Cleaned up Dockerfile
- Use prefork server instead of daemon
This commit is contained in:
swagg boi 2021-04-15 17:35:28 -04:00
parent 63d130d6b5
commit 2e6630eff9
3 changed files with 47 additions and 21 deletions

View file

@ -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"]

View file

@ -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

12
cpanfile Normal file
View file

@ -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';