Get production docker image building and tested with local nginx build. all working

This commit is contained in:
ICScaryThings 2022-07-01 21:30:38 -04:00
parent a679f94d6e
commit 4fe5984240
4 changed files with 53 additions and 3 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
# Production container: only core debian and treebird FCGI deps
FROM debian:testing
RUN apt update && apt upgrade -y
RUN apt install -y libcurl3-gnutls libfcgi0ldbl fcgiwrap
WORKDIR treebird
COPY treebird-fcgi /usr/local/bin/treebird
CMD fcgiwrap -c 10 -f -s tcp:0.0.0.0:4008

View File

@ -1,7 +1,32 @@
#!/bin/sh
# builds the 'build' image for compiling and testing
# Builds both the 'build' and release containers. The build container is used to
# compile the code and is kept independently so it can actually be run for testing
# and debugging, but only the release image should be run on production servers.
release=${1:-latest}
outdir="treebird-${release}"
git submodule init
git submodule update
docker build -t treebird:build -f Dockerfile.build .
build_image="treebird:${release}-build"
docker build -t "${build_image}" -f Dockerfile.build .
[ $? -eq 0 ] || (exit 1 && echo build failed!)
[ -d "${outdir}" ] || mkdir "${outdir}"
static_files="/usr/local/share/treebird/dist/."
fcgi_bin_pth="/usr/local/bin/treebird"
docker run --rm --name "${outdir}-tmp" -d "${build_image}"
docker cp "${outdir}-tmp:${static_files}" "${outdir}/"
docker cp "${outdir}-tmp:${fcgi_bin_pth}" "${outdir}/"
docker stop "${outdir}-tmp"
[ $? -eq 0 ] || (exit 1 && echo failed to extract to outdir)
cp "${outdir}/treebird" treebird-fcgi
docker build -t "treebird:${release}" .
rm treebird-fcgi
[ $? -eq 0 ] || (exit 1 && echo failed to build release image)

View File

@ -1,2 +1,10 @@
#!/bin/sh
# builds a quick improvised nginx container to run treebird locally
release=${1:-latest}
[ ! -d to-webserv ] || rm -vr to-webserv
mkdir to-webserv
cp -r "../treebird-${release}/." to-webserv
docker build -t treebird-nginx-test .

View File

@ -1,4 +1,11 @@
#!/bin/sh
# runs the treebird image as a docker daemon
instance=${1:-https://sleepy.cafe/}
release=${2:-latest}
docker run --rm --name treebird -p 4008:4008 -e TREEBIRD_CFG_INSTANCE_URL="https://sleepy.cafe/" -d treebird:build
docker run \
--rm \
--name treebird \
-p 4008:4008 \
-e TREEBIRD_CFG_INSTANCE_URL="${instance}" \
-d "treebird:${release}"