Docker build

This commit is contained in:
SebClem 2024-08-13 13:47:22 +02:00
parent b915633d2a
commit 63b3a8371d
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
3 changed files with 82 additions and 82 deletions

View File

@ -79,92 +79,92 @@ jobs:
name: back_dist name: back_dist
path: nextcloud_backup/backend/dist/ path: nextcloud_backup/backend/dist/
# build-dockers: build-dockers:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# strategy: strategy:
# fail-fast: false fail-fast: false
# matrix: matrix:
# arch: [ aarch64, amd64, armv7, i386, armhf ] arch: [ aarch64, amd64, armv7, i386, armhf ]
# include: include:
# - arch: aarch64 - arch: aarch64
# arch_value: linux/arm64/v8 arch_value: linux/arm64/v8
# - arch: amd64 - arch: amd64
# arch_value: linux/amd64 arch_value: linux/amd64
# - arch: armv7 - arch: armv7
# arch_value: linux/arm/v7 arch_value: linux/arm/v7
# - arch: i386 - arch: i386
# arch_value: linux/386 arch_value: linux/386
# - arch: armhf - arch: armhf
# arch_value: linux/arm/v6 arch_value: linux/arm/v6
# steps: steps:
# - uses: actions/checkout@v3 - uses: actions/checkout@v3
# - name: Set up QEMU - name: Set up QEMU
# uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
# - name: Set up Docker Buildx ${{matrix.arch}} - name: Set up Docker Buildx ${{matrix.arch}}
# uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
# - name: Set Version Prod ${{matrix.arch}} - name: Set Version Prod ${{matrix.arch}}
# if: github.event_name != 'workflow_dispatch' && github.event_name != 'push' if: github.event_name != 'workflow_dispatch' && github.event_name != 'push'
# run: | run: |
# version=${GITHUB_REF/refs\/tags\//} version=${GITHUB_REF/refs\/tags\//}
# if [ -n "$version" ];then if [ -n "$version" ];then
# tmp=$(mktemp) tmp=$(mktemp)
# jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
# fi fi
# echo "version_type=prod" >> $GITHUB_ENV echo "version_type=prod" >> $GITHUB_ENV
# - name: Set Version Test ${{matrix.arch}} - name: Set Version Test ${{matrix.arch}}
# if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
# run: | run: |
# version=dev_${GITHUB_RUN_ID} version=dev_${GITHUB_RUN_ID}
# if [ -n "$version" ];then if [ -n "$version" ];then
# tmp=$(mktemp) tmp=$(mktemp)
# jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
# fi fi
# echo "version_type=dev" >> $GITHUB_ENV echo "version_type=dev" >> $GITHUB_ENV
# - name: Get build option ${{matrix.arch}} - name: Get build option ${{matrix.arch}}
# run: | run: |
# echo "NAME=$(jq --raw-output '.name // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV echo "NAME=$(jq --raw-output '.name // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV
# echo "DESCRIPTION=$(jq --raw-output '.description // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV echo "DESCRIPTION=$(jq --raw-output '.description // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV
# echo "URL=$(jq --raw-output '.url // empty' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV echo "URL=$(jq --raw-output '.url // empty' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
# echo "VERSION=$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV echo "VERSION=$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
# echo "BUILD_FROM=ghcr.io/hassio-addons/base/${{matrix.arch}}:$(cat nextcloud_backup/.base_version)" >> $GITHUB_ENV echo "BUILD_FROM=ghcr.io/home-assistant/${{matrix.arch}}-base:$(cat nextcloud_backup/.base_version)" >> $GITHUB_ENV
# - name: Set Tags ${{matrix.arch}} - name: Set Tags ${{matrix.arch}}
# run: | run: |
# if [ "${{env.version_type}}" != "dev" ]; then if [ "${{env.version_type}}" != "dev" ]; then
# echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
# else else
# echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:dev, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:dev, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
# fi fi
# - name: Debug Env - name: Debug Env
# run: | run: |
# echo ${{env.VERSION}} echo ${{env.VERSION}}
# echo ${{env.TAGS}} echo ${{env.TAGS}}
# - name: Login to ghcr.io - name: Login to ghcr.io
# uses: docker/login-action@v2 uses: docker/login-action@v2
# with: with:
# registry: ghcr.io registry: ghcr.io
# username: ${{ github.actor }} username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and push ${{matrix.arch}} - name: Build and push ${{matrix.arch}}
# uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
# with: with:
# push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
# tags: ${{env.TAGS}} tags: ${{env.TAGS}}
# labels: io.hass.name=${{env.NAME}}, io.hass.description=${{env.DESCRIPTION}}, io.hass.url=${{env.URL}}, io.hass.arch=${{matrix.arch}}, io.hass.version=${{env.VERSION}}, io.hass.type=addon labels: io.hass.name=${{env.NAME}}, io.hass.description=${{env.DESCRIPTION}}, io.hass.url=${{env.URL}}, io.hass.arch=${{matrix.arch}}, io.hass.version=${{env.VERSION}}, io.hass.type=addon
# build-args: | build-args: |
# BUILD_FROM=${{env.BUILD_FROM}} BUILD_FROM=${{env.BUILD_FROM}}
# BUILD_VERSION=${{env.VERSION}} BUILD_VERSION=${{env.VERSION}}
# IMAGE_SOURCE=${{env.IMAGE_SOURCE}} IMAGE_SOURCE=${{env.IMAGE_SOURCE}}
# file: ./${{env.TARGET}}/Dockerfile file: ./${{env.TARGET}}/Dockerfile
# cache-from: type=registry,ref=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest cache-from: type=registry,ref=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest
# cache-to: type=inline cache-to: type=inline
# context: ./${{env.TARGET}}/ context: ./${{env.TARGET}}/
# platforms: ${{ matrix.arch_value }} platforms: ${{ matrix.arch_value }}

View File

@ -22,7 +22,8 @@ COPY backend/ .
RUN pnpm build RUN pnpm build
FROM ghcr.io/hassio-addons/base/amd64:16.2.1 ARG BUILD_FROM=ghcr.io/home-assistant/amd64-base:3.18
FROM $BUILD_FROM
# Copy root filesystem # Copy root filesystem
COPY rootfs/etc /etc/ COPY rootfs/etc /etc/

View File

@ -1 +0,0 @@
/usr/bin/nextcloud_backup.sh false root 0755 0755