From 6a35df458a99eaca4c3525c3c38885b3a0e1b533 Mon Sep 17 00:00:00 2001 From: ICScaryThings Date: Sat, 21 May 2022 15:47:21 -0400 Subject: [PATCH] Update docker build packages and add build script --- Dockerfile | 8 +++++++- build_container.sh | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 build_container.sh diff --git a/Dockerfile b/Dockerfile index 0522655..cb4e08d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,15 @@ FROM debian:testing # FROM nginx # cant use this because it uses debian stable with ancient packeges +ENV BUILD_REQ="build-essential libcurl4-gnutls-dev libcjson-dev libpcre3-dev libfcgi-dev git pkgconf" +ENV RUN_REQ="spawn-fcgi fcgiwrap" + RUN apt update && apt upgrade -y -RUN apt install -y build-essential libcurl4-gnutls-dev libcjson-dev libpcre3-dev libfcgi-dev git pkgconf +RUN apt install -y $BUILD_REQ $RUN_REQ ENV TB_BUILD_DIR=/usr/local/src/treebird COPY treebird $TB_BUILD_DIR RUN make -C $TB_BUILD_DIR && make -C $TB_BUILD_DIR install + +# Fix broken permissions BS +RUN chmod a+x diff --git a/build_container.sh b/build_container.sh new file mode 100755 index 0000000..186fc0a --- /dev/null +++ b/build_container.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Build the container image and perfom additional steps +IMAGE_NAME=${1:-treebird:latest} +CONTAINER_NAME=${2:-treebird} + +RESOURCES_SRC=/usr/local/share/dist +RESOURCES_DST=./to-webserv + +docker build -t $IMAGE_NAME . + +# copy out the shared dist files +docker run --rm --name $CONTAINER_NAME -d $IMAGE_NAME +docker cp ${CONTAINER_NAME}:${RESOURCES_SRC} ${RESOURCES_DST} +docker stop $CONTAINER_NAME