Skip to content

Commit 7bb5c4a

Browse files
committed
custom chores
1 parent 95449d2 commit 7bb5c4a

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

.github/workflows/docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build Docker Image
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
packages: write
10+
contents: read
11+
attestations: write
12+
id-token: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build environment variable
17+
run: |
18+
echo "BUILD_IMAGE=nixielectra/nginx-proxy-manager" >> $GITHUB_ENV
19+
echo "BUILD_PLATFORM=linux/amd64,linux/arm64" >> $GITHUB_ENV
20+
echo "BUILD_VERSION=$(cat .version)" >> $GITHUB_ENV
21+
- name: BuildTag
22+
run: |
23+
echo "BUILD_TAG=-t ${BUILD_IMAGE}:${BUILD_VERSION} -t ${BUILD_IMAGE}:latest" >> $GITHUB_ENV
24+
- name: Set Docker credentials
25+
env:
26+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
27+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
28+
run: echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
- name: Buildx output variables
32+
run: |
33+
echo "BUILD_TAG=$BUILD_TAG"
34+
echo "BUILD_IMAGE=$BUILD_IMAGE"
35+
echo "BUILD_PLATFORM=$BUILD_PLATFORM"
36+
echo "BUILD_VERSION=$BUILD_VERSION"
37+
- name: Buildx Dockerfile
38+
run: |
39+
chmod -R 755 scripts
40+
./scripts/buildx-nixie

docker/Dockerfile-nixie

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM jc21/nginx-proxy-manager:latest
2+
3+
EXPOSE 80 81 443
4+
5+
RUN rm -rf /app/internal/certificate.js /app/internal/ip_ranges.js /app/templates/proxy_host.conf
6+
COPY backend/internal/certificate.js /app/internal/certificate.js
7+
COPY backend/internal/ip_ranges.js /app/internal/ip_ranges.js
8+
COPY backend/templates/proxy_host.conf /app/templates/proxy_host.conf
9+
10+
WORKDIR /app
11+
12+
VOLUME [ "/data", "/etc/letsencrypt" ]
13+
ENTRYPOINT [ "/init" ]
14+
15+
LABEL org.label-schema.schema-version="1.0" \
16+
org.label-schema.license="MIT" \
17+
org.label-schema.name="nginx-proxy-manager" \
18+
org.label-schema.description="Docker container for managing Nginx proxy hosts with a simple, powerful interface " \
19+
org.label-schema.url="https://github.com/nixielectra/nginx-proxy-manager" \
20+
org.label-schema.vcs-url="https://github.com/nixielectra/nginx-proxy-manager.git" \
21+
org.label-schema.cmd="docker run --rm -ti nixielectra/nginx-proxy-manager:latest"

scripts/buildx-nixie

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
. "$DIR/ci/test-and-build-nixie"
5+
6+
cd "${DIR}/../.."
7+
8+
# Buildx Builder
9+
docker buildx create --name "Buildx-NPM" || echo
10+
docker buildx use "Buildx-NPM"
11+
12+
if [ "${BUILD_TAG:-0}" != 0 ]; then
13+
docker buildx build -f docker/Dockerfile-nixie $BUILD_TAG --platform $BUILD_PLATFORM . --push
14+
else
15+
docker buildx build -f docker/Dockerfile-nixie -t "nixielectra/nginx-proxy-manager:dev" --platform $BUILD_PLATFORM . --push
16+
fi
17+
18+
docker buildx rm "Buildx-NPM"
19+
20+
echo "Multiarch build Complete"

scripts/ci/test-and-build-nixie

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -e
2+
3+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
. "$DIR/../.common.sh"
5+
6+
TESTING_IMAGE=nginxproxymanager/nginx-full:certbot-node
7+
docker pull "${TESTING_IMAGE}"
8+
9+
# Test
10+
echo -e "${BLUE}${CYAN}Testing backend ...${RESET}"
11+
docker run --rm \
12+
-v "$(pwd)/backend:/app" \
13+
-v "$(pwd)/global:/app/global" \
14+
-w /app \
15+
"${TESTING_IMAGE}" \
16+
sh -c 'yarn install && yarn eslint . && rm -rf node_modules'
17+
echo -e "${BLUE}${GREEN}Testing Complete${RESET}"
18+
19+
# Build
20+
echo -e "${BLUE}${CYAN}Building ...${RESET}"
21+
docker build --pull --no-cache --compress \
22+
-t "${IMAGE:-nginx-proxy-manager}:${BRANCH_LOWER:-unknown}-ci-${BUILD_NUMBER:-0000}" \
23+
-f docker/Dockerfile-nixie \
24+
--progress=plain \
25+
--build-arg TARGETPLATFORM=linux/amd64 \
26+
--build-arg BUILDPLATFORM=linux/amd64 \
27+
--build-arg BUILD_VERSION="${BUILD_VERSION:-unknown}" \
28+
--build-arg BUILD_COMMIT="${BUILD_COMMIT:-unknown}" \
29+
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \
30+
.
31+
echo -e "${BLUE}${GREEN}Building Complete${RESET}"

0 commit comments

Comments
 (0)