~jeffa/jeffa.io

e1d7e192c7c2c3bdb449977dc734cecd2ca13df2 — Jeff 8 months ago 80c935e
Add scripts to run container in production and development
2 files changed, 49 insertions(+), 0 deletions(-)

A docker-dev.sh
A docker-run.sh
A docker-dev.sh => docker-dev.sh +22 -0
@@ 0,0 1,22 @@
#! /bin/bash
DEV_PORT="8080"

echo "Clearing docker containers...";

docker stop $(docker ps -aq);
docker rm $(docker ps -aq);

echo "Building container...";

docker build -t jkanderson409/jeffa.io .;

echo "Running container...";

docker run \
    --name jeffa.io \
    --detach \
    --volume /mnt/blockstorage:/etc/letsencrypt \
    --publish 8080:80 \
    jkanderson409/jeffa.io;

echo "Container is running at $DEV_PORT";

A docker-run.sh => docker-run.sh +27 -0
@@ 0,0 1,27 @@
#! /bin/bash
echo "Clearing docker containers and images...";
sleep 3;

docker stop "$(docker ps -aq)";
docker rm "$(docker ps -aq)";
docker rmi "$(docker images -aq)";

echo "Fetching and running new container...";
sleep 3;

docker run \
    --name jeffa.io \
    --detach \
    --volume /mnt/blockstorage:/etc/letsencrypt \
    --publish 80:80 \
    --publish 443:443 \
    --restart always \
    jkanderson409/jeffa.io;

docker exec \
    jeffa.io \
    certbot run \
        -n \
        --nginx \
        --domain jeffa.io \
        --domain www.jeffa.io;