1
0
mirror of https://github.com/dokku/buildpack-nginx.git synced 2026-04-24 09:37:36 +00:00

6 Commits
v30 ... master

Author SHA1 Message Date
9c8f348d58 Merge pull request #102 from dokku/fix-missing-logs-dir
fix: create nginx logs directory for precompiled binary builds
2026-04-23 04:27:23 -04:00
5b53da2756 fix: create nginx logs directory for precompiled binary builds
The precompiled binary and cache code paths only copy the nginx binary
without creating the logs/ directory that make install normally creates.
This causes nginx to fail at startup with a fatal error when trying to
open compiled-in default log paths at /app/nginx/logs/.
2026-04-23 04:17:18 -04:00
8d1b1afa9f Merge pull request #101 from dokku/versioned-build
fix: version-aware nginx binary caching and prebuilt downloads
2026-04-23 03:39:51 -04:00
93f1162632 fix: version-aware nginx binary caching and prebuilt downloads
Cached nginx binaries were reused regardless of NGINX_VERSION changes,
and prebuilt releases always fetched the latest asset regardless of the
configured version. Add a .nginx-version marker file to the cache and
version the release asset filename so mismatched versions trigger a
rebuild.
2026-04-23 03:36:20 -04:00
73e762c693 Merge pull request #100 from dokku/deploy-head
feat: set buildpack ref on main branch deploys
2026-04-23 03:16:46 -04:00
e5f2625df2 feat: set buildpack ref on main branch deploys
The ci-pre-deploy script already sets the buildpack ref for review
apps via a .buildpacks file. For main/master branch deploys, use
dokku buildpacks:set to pin the buildpack to the current branch ref.
2026-04-23 03:16:18 -04:00
3 changed files with 24 additions and 6 deletions

View File

@ -62,7 +62,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
source "$GITHUB_WORKSPACE/conf/nginx-configure-flags"
cp /tmp/nginx-${NGINX_VERSION}/objs/nginx /tmp/nginx-linux-amd64
chmod +x /tmp/nginx-linux-amd64
cp /tmp/nginx-${NGINX_VERSION}/objs/nginx "/tmp/nginx-${NGINX_VERSION}-linux-amd64"
chmod +x "/tmp/nginx-${NGINX_VERSION}-linux-amd64"
gh release upload "${{ github.event.release.tag_name }}" \
/tmp/nginx-linux-amd64
"/tmp/nginx-${NGINX_VERSION}-linux-amd64"

View File

@ -25,4 +25,7 @@ if [ "$IS_REVIEW_APP" = "true" ]; then
git commit -qm "feat: specify $GITHUB_SHA as buildpack"
git rev-parse HEAD >ci-commit-override
else
echo "-----> Setting the buildpack to the current ref $GITHUB_REF_NAME"
ssh "$SSH_REMOTE" -- buildpacks:set "$APP_NAME" "https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_REF_NAME}"
fi

View File

@ -60,18 +60,29 @@ if [[ ! -f "$BUILD_DIR/sigil/sigil" ]]; then
exit 1
fi
# Invalidate cache if version doesn't match
if [[ -f "${CACHE_DIR}/bin/nginx" ]] && [[ ! -f "${CACHE_DIR}/bin/.nginx-version" ]]; then
echo "-----> Cached nginx binary has no version marker, rebuilding"
rm -rf "${CACHE_DIR:?}/bin"
elif [[ -f "${CACHE_DIR}/bin/nginx" ]] && [[ -f "${CACHE_DIR}/bin/.nginx-version" ]] && [[ "$(cat "${CACHE_DIR}/bin/.nginx-version")" != "$NGINX_VERSION" ]]; then
CACHED_VERSION="$(cat "${CACHE_DIR}/bin/.nginx-version")"
echo "-----> Cached nginx ${CACHED_VERSION} does not match required ${NGINX_VERSION}, rebuilding"
rm -rf "${CACHE_DIR:?}/bin"
fi
if [[ -f "${CACHE_DIR}/bin/nginx" ]]; then
echo "-----> Reusing nginx binary from cache"
echo "-----> Reusing nginx ${NGINX_VERSION} binary from cache"
mkdir -p "$BUILD_DIR/nginx"
# shellcheck disable=SC2086
cp -r $CACHE_DIR/bin/* "$BUILD_DIR/nginx/"
elif curl -fsSL "https://github.com/${BUILDPACK_REPO}/releases/latest/download/nginx-linux-amd64" -o /tmp/nginx-linux-amd64 2>/dev/null; then
echo "-----> Using precompiled nginx binary"
elif curl -fsSL "https://github.com/${BUILDPACK_REPO}/releases/latest/download/nginx-${NGINX_VERSION}-linux-amd64" -o /tmp/nginx-linux-amd64 2>/dev/null; then
echo "-----> Using precompiled nginx ${NGINX_VERSION} binary"
mkdir -p "$BUILD_DIR/nginx" "${CACHE_DIR}/bin"
chmod +x /tmp/nginx-linux-amd64
cp /tmp/nginx-linux-amd64 "$BUILD_DIR/nginx/nginx"
cp /tmp/nginx-linux-amd64 "${CACHE_DIR}/bin/nginx"
echo "$NGINX_VERSION" >"${CACHE_DIR}/bin/.nginx-version"
rm -f /tmp/nginx-linux-amd64
else
@ -109,8 +120,12 @@ else
rm -rf "${CACHE_DIR:?}/bin" && mkdir -p "$CACHE_DIR/bin/"
# shellcheck disable=SC2086
cp -r $BUILD_DIR/nginx/* "$CACHE_DIR/bin/"
echo "$NGINX_VERSION" >"${CACHE_DIR}/bin/.nginx-version"
fi
# Create logs directory for nginx's compiled-in default log paths
mkdir -p "$BUILD_DIR/nginx/logs"
# Update the PATH
mkdir -p "$BUILD_DIR/.profile.d"
cat >"$BUILD_DIR/.profile.d/nginx.sh" <<"EOF"