diff options
-rw-r--r-- | .github/workflows/dockerhub.yml | 44 | ||||
-rw-r--r-- | .github/workflows/integration.yml | 2 | ||||
-rw-r--r-- | .github/workflows/release.yml | 24 | ||||
-rw-r--r-- | Dockerfile.arm32v7 | 49 | ||||
-rw-r--r-- | Dockerfile.arm64v8 | 49 | ||||
-rw-r--r-- | hooks/post_push | 8 | ||||
-rw-r--r-- | hooks/pre_build | 8 |
7 files changed, 51 insertions, 133 deletions
diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml new file mode 100644 index 0000000..68e3d67 --- /dev/null +++ b/.github/workflows/dockerhub.yml | |||
@@ -0,0 +1,44 @@ | |||
1 | # Build & publish docker images | ||
2 | name: Dockerhub | ||
3 | |||
4 | on: | ||
5 | push: | ||
6 | tags: [v*] | ||
7 | branches: [ main ] | ||
8 | |||
9 | |||
10 | jobs: | ||
11 | dockerhub: | ||
12 | runs-on: ubuntu-latest | ||
13 | steps: | ||
14 | - | ||
15 | name: Checkout | ||
16 | uses: actions/checkout@v3 | ||
17 | - | ||
18 | name: Set up QEMU | ||
19 | uses: docker/setup-qemu-action@v2 | ||
20 | - | ||
21 | name: Set up Docker Buildx | ||
22 | id: buildx | ||
23 | uses: docker/setup-buildx-action@v2 | ||
24 | - | ||
25 | name: Login to Docker Hub | ||
26 | uses: docker/login-action@v2 | ||
27 | with: | ||
28 | username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
29 | password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
30 | - | ||
31 | name: Set tag name | ||
32 | run: | | ||
33 | if [[ ${{ github.ref_type }} == "tag" ]]; then | ||
34 | echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV | ||
35 | else | ||
36 | echo "IMAGE_TAG=latest" >> $GITHUB_ENV | ||
37 | fi | ||
38 | - | ||
39 | name: Build and push | ||
40 | uses: docker/build-push-action@v3 | ||
41 | with: | ||
42 | push: true | ||
43 | tags: b4bz/buildx-test:${{env.IMAGE_TAG}} | ||
44 | platforms: linux/amd64,linux/arm/v7,linux/arm64 \ No newline at end of file | ||
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8d1a7ad..257f758 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml | |||
@@ -20,7 +20,7 @@ jobs: | |||
20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
21 | 21 | ||
22 | steps: | 22 | steps: |
23 | - uses: actions/checkout@v2 | 23 | - uses: actions/checkout@v3 |
24 | - name: Use Node.js ${{ matrix.node-version }} | 24 | - name: Use Node.js ${{ matrix.node-version }} |
25 | uses: actions/setup-node@v2 | 25 | uses: actions/setup-node@v2 |
26 | with: | 26 | with: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 886556d..62c15a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml | |||
@@ -10,7 +10,7 @@ jobs: | |||
10 | name: Upload Release Asset | 10 | name: Upload Release Asset |
11 | runs-on: ubuntu-latest | 11 | runs-on: ubuntu-latest |
12 | steps: | 12 | steps: |
13 | - uses: actions/checkout@v2 | 13 | - uses: actions/checkout@v3 |
14 | - name: Build project | 14 | - name: Build project |
15 | run: | | 15 | run: | |
16 | yarn install | 16 | yarn install |
@@ -20,21 +20,9 @@ jobs: | |||
20 | run: zip -r ../homer.zip ./* | 20 | run: zip -r ../homer.zip ./* |
21 | - name: Create Release | 21 | - name: Create Release |
22 | id: create_release | 22 | id: create_release |
23 | uses: actions/create-release@v1 | 23 | uses: softprops/action-gh-release@v1 |
24 | env: | ||
25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
26 | with: | 24 | with: |
27 | tag_name: ${{ github.ref }} | 25 | token: ${{ secrets.GITHUB_TOKEN }} |
28 | release_name: Release ${{ github.ref }} | 26 | generate_release_notes: true |
29 | draft: false | 27 | files: | |
30 | prerelease: false | 28 | homer.zip \ No newline at end of file |
31 | - name: Upload Release Asset | ||
32 | id: upload-release-asset | ||
33 | uses: actions/upload-release-asset@v1 | ||
34 | env: | ||
35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
36 | with: | ||
37 | upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
38 | asset_path: ./homer.zip | ||
39 | asset_name: homer.zip | ||
40 | asset_content_type: application/zip | ||
diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 deleted file mode 100644 index 270d7b5..0000000 --- a/Dockerfile.arm32v7 +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | # build stage | ||
2 | FROM node:lts-alpine as build-stage | ||
3 | |||
4 | WORKDIR /app | ||
5 | |||
6 | COPY package*.json ./ | ||
7 | RUN yarn install --frozen-lockfile | ||
8 | |||
9 | COPY . . | ||
10 | RUN yarn build | ||
11 | |||
12 | # Multi arch build support | ||
13 | FROM alpine as qemu | ||
14 | |||
15 | ARG QEMU_VERSION="v4.2.0-7" | ||
16 | |||
17 | RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-arm-static && chmod +x qemu-arm-static | ||
18 | |||
19 | # production stage | ||
20 | FROM arm32v7/alpine:3.16 | ||
21 | |||
22 | COPY --from=qemu qemu-arm-static /usr/bin/ | ||
23 | |||
24 | ENV GID 1000 | ||
25 | ENV UID 1000 | ||
26 | ENV PORT 8080 | ||
27 | ENV SUBFOLDER "/_" | ||
28 | ENV INIT_ASSETS 1 | ||
29 | |||
30 | RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd && \ | ||
31 | apk add -U --no-cache lighttpd && \ | ||
32 | rm /usr/bin/qemu-arm-static | ||
33 | |||
34 | WORKDIR /www | ||
35 | |||
36 | COPY lighttpd.conf /lighttpd.conf | ||
37 | COPY entrypoint.sh /entrypoint.sh | ||
38 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/ | ||
39 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets | ||
40 | |||
41 | USER ${UID}:${GID} | ||
42 | |||
43 | HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ | ||
44 | CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 | ||
45 | |||
46 | EXPOSE ${PORT} | ||
47 | VOLUME /www/assets | ||
48 | |||
49 | CMD ["lighttpd", "-D", "-f", "/lighttpd.conf"] | ||
diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 deleted file mode 100644 index f940bde..0000000 --- a/Dockerfile.arm64v8 +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | # build stage | ||
2 | FROM node:lts-alpine as build-stage | ||
3 | |||
4 | WORKDIR /app | ||
5 | |||
6 | COPY package*.json ./ | ||
7 | RUN yarn install --frozen-lockfile | ||
8 | |||
9 | COPY . . | ||
10 | RUN yarn build | ||
11 | |||
12 | # Multi arch build support | ||
13 | FROM alpine as qemu | ||
14 | |||
15 | ARG QEMU_VERSION="v4.2.0-7" | ||
16 | |||
17 | RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-aarch64-static && chmod +x qemu-aarch64-static | ||
18 | |||
19 | # production stage | ||
20 | FROM arm64v8/alpine:3.16 | ||
21 | |||
22 | COPY --from=qemu qemu-aarch64-static /usr/bin/ | ||
23 | |||
24 | ENV GID 1000 | ||
25 | ENV UID 1000 | ||
26 | ENV PORT 8080 | ||
27 | ENV SUBFOLDER "/_" | ||
28 | ENV INIT_ASSETS 1 | ||
29 | |||
30 | RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd && \ | ||
31 | apk add -U --no-cache lighttpd && \ | ||
32 | rm /usr/bin/qemu-aarch64-static | ||
33 | |||
34 | WORKDIR /www | ||
35 | |||
36 | COPY lighttpd.conf /lighttpd.conf | ||
37 | COPY entrypoint.sh /entrypoint.sh | ||
38 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/ | ||
39 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets | ||
40 | |||
41 | USER ${UID}:${GID} | ||
42 | |||
43 | HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ | ||
44 | CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 | ||
45 | |||
46 | EXPOSE ${PORT} | ||
47 | VOLUME /www/assets | ||
48 | |||
49 | CMD ["lighttpd", "-D", "-f", "/lighttpd.conf"] | ||
diff --git a/hooks/post_push b/hooks/post_push deleted file mode 100644 index 3d4830d..0000000 --- a/hooks/post_push +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | IFS='-' read -r TAG string <<< "$DOCKER_TAG" | ||
4 | |||
5 | docker manifest create b4bz/homer:$TAG b4bz/homer:$TAG-amd64 b4bz/homer:$TAG-arm32v7 b4bz/homer:$TAG-arm64v8 | ||
6 | docker manifest annotate b4bz/homer:$TAG b4bz/homer:$TAG-arm32v7 --os linux --arch arm | ||
7 | docker manifest annotate b4bz/homer:$TAG b4bz/homer:$TAG-arm64v8 --os linux --arch arm64 --variant v8 | ||
8 | docker manifest push --purge b4bz/homer:$TAG | ||
diff --git a/hooks/pre_build b/hooks/pre_build deleted file mode 100644 index bc1b6fe..0000000 --- a/hooks/pre_build +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Update to docker-ee 18.x for manifests | ||
4 | apt-get -y update | ||
5 | apt-get -y --only-upgrade install docker-ee | ||
6 | # Register qemu-*-static for all supported processors except the | ||
7 | # current one, but also remove all registered binfmt_misc before | ||
8 | docker run --rm --privileged multiarch/qemu-user-static:register --reset \ No newline at end of file | ||