aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2022-06-12 16:15:54 +0200
committerBastien Wirtz <bastien.wirtz@gmail.com>2022-06-12 16:15:54 +0200
commita43fe354ec6e6226a41ecfd98cd0343a54e5a428 (patch)
tree0bb759707fb4a8a7f0844327c2b77ba349ea01d5
parent1327cc0ab0e78d0cfc2fe11fddca8cc32dae8ac6 (diff)
downloadhomer-a43fe354ec6e6226a41ecfd98cd0343a54e5a428.tar.gz
homer-a43fe354ec6e6226a41ecfd98cd0343a54e5a428.tar.zst
homer-a43fe354ec6e6226a41ecfd98cd0343a54e5a428.zip
Simplified & updated CI/CD
-rw-r--r--.github/workflows/dockerhub.yml44
-rw-r--r--.github/workflows/integration.yml2
-rw-r--r--.github/workflows/release.yml24
-rw-r--r--Dockerfile.arm32v749
-rw-r--r--Dockerfile.arm64v849
-rw-r--r--hooks/post_push8
-rw-r--r--hooks/pre_build8
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
2name: Dockerhub
3
4on:
5 push:
6 tags: [v*]
7 branches: [ main ]
8
9
10jobs:
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
2FROM node:lts-alpine as build-stage
3
4WORKDIR /app
5
6COPY package*.json ./
7RUN yarn install --frozen-lockfile
8
9COPY . .
10RUN yarn build
11
12# Multi arch build support
13FROM alpine as qemu
14
15ARG QEMU_VERSION="v4.2.0-7"
16
17RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-arm-static && chmod +x qemu-arm-static
18
19# production stage
20FROM arm32v7/alpine:3.16
21
22COPY --from=qemu qemu-arm-static /usr/bin/
23
24ENV GID 1000
25ENV UID 1000
26ENV PORT 8080
27ENV SUBFOLDER "/_"
28ENV INIT_ASSETS 1
29
30RUN 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
34WORKDIR /www
35
36COPY lighttpd.conf /lighttpd.conf
37COPY entrypoint.sh /entrypoint.sh
38COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/
39COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets
40
41USER ${UID}:${GID}
42
43HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
44 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1
45
46EXPOSE ${PORT}
47VOLUME /www/assets
48
49CMD ["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
2FROM node:lts-alpine as build-stage
3
4WORKDIR /app
5
6COPY package*.json ./
7RUN yarn install --frozen-lockfile
8
9COPY . .
10RUN yarn build
11
12# Multi arch build support
13FROM alpine as qemu
14
15ARG QEMU_VERSION="v4.2.0-7"
16
17RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-aarch64-static && chmod +x qemu-aarch64-static
18
19# production stage
20FROM arm64v8/alpine:3.16
21
22COPY --from=qemu qemu-aarch64-static /usr/bin/
23
24ENV GID 1000
25ENV UID 1000
26ENV PORT 8080
27ENV SUBFOLDER "/_"
28ENV INIT_ASSETS 1
29
30RUN 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
34WORKDIR /www
35
36COPY lighttpd.conf /lighttpd.conf
37COPY entrypoint.sh /entrypoint.sh
38COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/
39COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets
40
41USER ${UID}:${GID}
42
43HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
44 CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1
45
46EXPOSE ${PORT}
47VOLUME /www/assets
48
49CMD ["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
3IFS='-' read -r TAG string <<< "$DOCKER_TAG"
4
5docker manifest create b4bz/homer:$TAG b4bz/homer:$TAG-amd64 b4bz/homer:$TAG-arm32v7 b4bz/homer:$TAG-arm64v8
6docker manifest annotate b4bz/homer:$TAG b4bz/homer:$TAG-arm32v7 --os linux --arch arm
7docker manifest annotate b4bz/homer:$TAG b4bz/homer:$TAG-arm64v8 --os linux --arch arm64 --variant v8
8docker 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
4apt-get -y update
5apt-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
8docker run --rm --privileged multiarch/qemu-user-static:register --reset \ No newline at end of file