Skip to content

Commit a5656b1

Browse files
fix cp_bin function
1 parent 829886f commit a5656b1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fetch_headers() {
2929
build_nginx() {
3030
local dockerArgs=${1:-}
3131

32-
printf "${BLUE} Building...${NC}"
32+
printf "${BLUE} Building NGINX...${NC}"
3333
docker image pull debian:bullseye-slim
3434
docker image pull nginx:${NGINX_VERSION}
3535
docker image build -t ${FULL_IMAGE_NAME}:latest -t ${FULL_IMAGE_NAME}:${NGINX_VERSION} --build-arg NGINX_VERSION=${NGINX_VERSION} ${dockerArgs} .
@@ -44,10 +44,12 @@ build_nginx() {
4444
}
4545

4646
rebuild_nginx() {
47+
printf "${BLUE} Rebuilding NGINX...${NC}"
4748
build_nginx --no-cache
4849
}
4950

5051
start_nginx() {
52+
printf "${BLUE} Starting NGINX...${NC}"
5153
docker run --rm --name "${IMAGE_NAME}" -d -p 8000:80 ${FULL_IMAGE_NAME}
5254
}
5355

@@ -56,13 +58,17 @@ stop_nginx() {
5658
}
5759

5860
cp_bin() {
61+
if [ "$(docker container inspect -f '{{.State.Running}}' ${IMAGE_NAME})" != "true" ]; then
62+
start_nginx
63+
fi
64+
5965
printf "${BLUE} Copying binaries...${NC}"
6066
rm -rf bin
6167
mkdir bin
62-
docker exec "${IMAGE_NAME}" sh -c "tar -chf - \
63-
/usr/lib64/nginx/modules/ngx_http_auth_jwt_module.so \
64-
/usr/lib/x86_64-linux-gnu/libjansson.so.* \
65-
/usr/lib/x86_64-linux-gnu/libjwt.*" 2>/dev/null | tar -xf - -C bin &>/dev/null
68+
docker exec "${IMAGE_NAME}" sh -c "cd /; tar -chf - \
69+
usr/lib64/nginx/modules/ngx_http_auth_jwt_module.so \
70+
usr/lib/x86_64-linux-gnu/libjansson.so.* \
71+
usr/lib/x86_64-linux-gnu/libjwt.*" | tar -xf - -C bin &>/dev/null
6672
}
6773

6874
build_test_runner() {

0 commit comments

Comments
 (0)