mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-28 11:40:04 +00:00
Version 3 starter
This commit is contained in:
19
scripts/build-cleanup
Executable file
19
scripts/build-cleanup
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/.common.sh"
|
||||
|
||||
# Ensure docker-compose exists
|
||||
if hash docker 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Build Cleanup ...${RESET}"
|
||||
|
||||
docker run --rm -e CI=true -v "$(pwd):/app" -w /app node:latest rm -rf \
|
||||
/app/frontend/node_modules \
|
||||
/app/docs/node_modules \
|
||||
/app/docs/.vuepress/dist
|
||||
|
||||
echo -e "${BLUE}❯ ${GREEN}Build Cleanup Complete${RESET}"
|
||||
else
|
||||
echo -e "${RED}❯ docker command is not available${RESET}"
|
||||
fi
|
@@ -1,12 +1,11 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/.common.sh"
|
||||
|
||||
echo -e "${BLUE}❯ ${CYAN}Building docker multiarch: ${YELLOW}${*}${RESET}"
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "${DIR}/.." || exit 1
|
||||
cd "${DIR}/.."
|
||||
|
||||
# determine commit if not already set
|
||||
if [ "$BUILD_COMMIT" == "" ]; then
|
||||
@@ -21,8 +20,10 @@ docker buildx build \
|
||||
--build-arg BUILD_VERSION="${BUILD_VERSION:-dev}" \
|
||||
--build-arg BUILD_COMMIT="${BUILD_COMMIT:-notset}" \
|
||||
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \
|
||||
--build-arg NOW="$(date --rfc-3339=s)" \
|
||||
--build-arg GOPROXY="${GOPROXY:-}" \
|
||||
--build-arg GOPRIVATE="${GOPRIVATE:-}" \
|
||||
--build-arg SENTRY_DSN="${SENTRY_DSN:-}" \
|
||||
--platform linux/amd64,linux/arm64,linux/arm/7 \
|
||||
--progress plain \
|
||||
--pull \
|
||||
@@ -30,7 +31,6 @@ docker buildx build \
|
||||
$@ \
|
||||
.
|
||||
|
||||
rc=$?
|
||||
docker buildx rm "${BUILDX_NAME:-npm}"
|
||||
|
||||
echo -e "${BLUE}❯ ${GREEN}Multiarch build Complete${RESET}"
|
||||
exit $rc
|
||||
|
34
scripts/ci/frontend-build
Executable file
34
scripts/ci/frontend-build
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
BACKEND_ASSETS=backend/internal/api/handler/assets
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/../.common.sh"
|
||||
|
||||
docker_cmd() {
|
||||
docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -w /app/frontend node:14 ${*}
|
||||
}
|
||||
|
||||
cd "${DIR}/../.." || exit 1
|
||||
echo -e "${BLUE}❯ ${CYAN}Installing Frontend deps ...${RESET}"
|
||||
rm -rf frontend/node_modules
|
||||
|
||||
docker_cmd yarn install
|
||||
echo -e "${BLUE}❯ ${CYAN}Running eslint ...${RESET}"
|
||||
docker_cmd yarn eslint src
|
||||
docker_cmd yarn eslint -f junit src -o eslint.xml
|
||||
echo -e "${BLUE}❯ ${CYAN}Running tests ...${RESET}"
|
||||
docker_cmd yarn test --coverage --watchAll=false --testResultsProcessor ./node_modules/jest-junit
|
||||
echo -e "${BLUE}❯ ${CYAN}Building Frontend ...${RESET}"
|
||||
docker_cmd yarn build
|
||||
docker_cmd chown -R "$(id -u):$(id -g)" /app/frontend
|
||||
echo -e "${BLUE}❯ ${GREEN}Building Frontend Complete${RESET}"
|
||||
|
||||
# to avoid CRA ejection, just copy these build files over to embed in the backend
|
||||
cp -pr frontend/build "${BACKEND_ASSETS}"
|
||||
echo -e "${BLUE}❯ ${GREEN}Copied build to ${BACKEND_ASSETS}${RESET}"
|
||||
|
||||
rm -rf frontend/node_modules
|
||||
|
||||
trap "rm -rf frontend/node_modules" EXIT
|
@@ -7,7 +7,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if hash docker 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Building Docs ...${RESET}"
|
||||
docker run --rm -e CI=true -v "$(pwd)/docs:/app/docs" -w /app/docs node:alpine sh -c "yarn install && yarn build && chown -R $(id -u):$(id -g) /app/docs"
|
||||
docker run --rm -e CI=true -v "$(pwd)/docs:/app/docs" -w /app/docs node:latest sh -c "yarn install && yarn build && chown -R $(id -u):$(id -g) /app/docs"
|
||||
echo -e "${BLUE}❯ ${GREEN}Building Docs Complete${RESET}"
|
||||
else
|
||||
echo -e "${RED}❯ docker command is not available${RESET}"
|
||||
|
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/.common.sh"
|
||||
|
||||
DOCKER_IMAGE=jc21/nginx-full:node
|
||||
|
||||
# Ensure docker exists
|
||||
if hash docker 2>/dev/null; then
|
||||
docker pull "${DOCKER_IMAGE}"
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Building Frontend ...${RESET}"
|
||||
docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -v "$(pwd)/global:/app/global" -w /app/frontend "$DOCKER_IMAGE" sh -c "yarn install && yarn build && yarn build && chown -R $(id -u):$(id -g) /app/frontend"
|
||||
echo -e "${BLUE}❯ ${GREEN}Building Frontend Complete${RESET}"
|
||||
else
|
||||
echo -e "${RED}❯ docker command is not available${RESET}"
|
||||
fi
|
17
scripts/frontend-lint
Executable file
17
scripts/frontend-lint
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/.common.sh"
|
||||
|
||||
# Ensure docker-compose exists
|
||||
if hash docker 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Linting Frontend ...${RESET}"
|
||||
docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -w /app/frontend node:latest sh -c "yarn install && yarn eslint src;chown -R $(id -u):$(id -g) /app/frontend"
|
||||
RES=$?
|
||||
echo -e "${BLUE}❯ ${GREEN}Linting Frontend Complete${RESET}"
|
||||
exit $RES
|
||||
else
|
||||
echo -e "${RED}❯ docker command is not available${RESET}"
|
||||
exit 1
|
||||
fi
|
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Note: This script is designed to be run inside a Docker Build for a container
|
||||
|
||||
CYAN='\E[1;36m'
|
||||
YELLOW='\E[1;33m'
|
||||
BLUE='\E[1;34m'
|
||||
GREEN='\E[1;32m'
|
||||
RESET='\E[0m'
|
||||
|
||||
S6_OVERLAY_VERSION=1.22.1.0
|
||||
TARGETPLATFORM=$1
|
||||
|
||||
# Determine the correct binary file for the architecture given
|
||||
case $TARGETPLATFORM in
|
||||
linux/arm64)
|
||||
S6_ARCH=aarch64
|
||||
;;
|
||||
|
||||
linux/arm/v7)
|
||||
S6_ARCH=armhf
|
||||
;;
|
||||
|
||||
*)
|
||||
S6_ARCH=amd64
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "${BLUE}❯ ${CYAN}Installing S6-overlay v${S6_OVERLAY_VERSION} for ${YELLOW}${TARGETPLATFORM} (${S6_ARCH})${RESET}"
|
||||
|
||||
curl -L -o "/tmp/s6-overlay-${S6_ARCH}.tar.gz" "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz" \
|
||||
&& tar -xzf "/tmp/s6-overlay-${S6_ARCH}.tar.gz" -C /
|
||||
|
||||
echo -e "${BLUE}❯ ${GREEN}S6-overlay install Complete${RESET}"
|
20
scripts/sqlite
Executable file
20
scripts/sqlite
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/.common.sh"
|
||||
|
||||
# Ensure docker-compose exists
|
||||
if hash docker-compose 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}Tip: List tables with: ${YELLOW}.tables${RESET}"
|
||||
echo -e "${CYAN}Tip: Describe a table with: ${YELLOW}.schema table_name${RESET}"
|
||||
echo -e "${CYAN}Tip: Show full schema with: ${YELLOW}.fullschema${RESET}"
|
||||
echo -e "${CYAN}Tip: Show indexes with: ${YELLOW}.indexes${RESET}"
|
||||
echo ""
|
||||
|
||||
docker-compose exec npm litecli /data/nginxproxymanager.db
|
||||
else
|
||||
echo -e "${RED}❯ docker-compose command is not available${RESET}"
|
||||
fi
|
@@ -7,7 +7,6 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if hash docker-compose 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Starting Dev Stack ...${RESET}"
|
||||
|
||||
docker-compose up -d --remove-orphans --force-recreate --build
|
||||
|
||||
echo ""
|
||||
@@ -20,8 +19,10 @@ if hash docker-compose 2>/dev/null; then
|
||||
echo -e "${BLUE}❯ ${YELLOW}Following Backend Container:${RESET}"
|
||||
docker logs -f npmdev_npm_1
|
||||
else
|
||||
echo -e "${YELLOW}Hint:${RESET} You can follow the output of some of the containers with:"
|
||||
echo -e "${YELLOW}Tip:${RESET} You can follow the output of some of the containers with:"
|
||||
echo " docker logs -f npmdev_npm_1"
|
||||
echo -e "${YELLOW}Tip:${RESET} Open a database terminal with:"
|
||||
echo " ./scripts/sqlite"
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}❯ docker-compose command is not available${RESET}"
|
||||
|
@@ -7,7 +7,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if hash docker-compose 2>/dev/null; then
|
||||
cd "${DIR}/.."
|
||||
echo -e "${BLUE}❯ ${CYAN}Testing Dev Stack ...${RESET}"
|
||||
docker-compose exec -T npm bash -c "cd /app && task test"
|
||||
docker-compose exec -T npm bash -c "cd /app/backend && task test"
|
||||
else
|
||||
echo -e "${RED}❯ docker-compose command is not available${RESET}"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user