Skip to content

Commit

Permalink
update ze builds
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Dec 22, 2022
1 parent db997ce commit d7cf394
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 27 deletions.
50 changes: 50 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.git
/examples
/init
!/init/buildinfo.sh
/scripts

# Change this line.
/notifiarr
/init/macos/*.app/Contents/MacOS/*
# The rest is probably fine.
/rsrc*.syso
/aur
/*.log
/*.conf
/cmd
/*.gz
/*.zip
/*.upx
/*.dmg
/*.1
/*.deb
/*.rpm
/*.txz
/*.*.arm
/*.*.exe
/*.*.macos
/*.*.linux
/*.*.freebsd
/*.rb
/*.upx
/*.app
*.sha256
/*.service
/vendor
.DS_Store
*~
/package_build_*
/release
MANUAL
MANUAL.html
README
README.html
/*_manual.html
/homebrew-mugs
.secret*files.tar
*key*
aur_deploy_key*
.metadata.make
/*-rendered.sh
/gpg.signing.key
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test

on:
push:
pull_request:
types: [opened, reopened, edited]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0

- uses: actions/setup-go@v3

- name: Make test
run: |
make test
14 changes: 8 additions & 6 deletions init/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ FROM golang:1-bullseye as builder
# Build speed magic!
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
WORKDIR /src
COPY go.mod go.sum .
COPY go.mod ./
COPY go.sum ./
RUN go mod download
RUN apt update && apt install -y libncurses5 libstdc++6 libtinfo5 apt-utils ca-certificates
COPY . .
RUN make generate

ARG TARGETOS
ARG BINARY
ARG TARGETARCH

# Build the app.
RUN CGO_ENABLED=1 make ${BINARY}.${TARGETARCH}.${TARGETOS}

# For megacli. All the *'s are to deal with multiarch. :(
RUN apt update && apt install -y libncurses5 libstdc++6 libtinfo5 apt-utils ca-certificates && \
curl -sSo /notifiarr.tgz https://raw.githubusercontent.com/Notifiarr/build-dependencies/main/notifiarr-docker-$TARGETARCH.tgz && \
RUN curl -sSo /notifiarr.tgz https://raw.githubusercontent.com/Notifiarr/build-dependencies/main/notifiarr-docker-$TARGETARCH.tgz && \
tar -zxf /notifiarr.tgz -C / && \
mkdir -p /tmp/lib_link /tmp$(ls -d /lib/*-linux-gnu*) && cp /usr/lib/*-linux-gnu*/libstdc++.so* \
/lib/*-linux-gnu*/ld-2.*.so /lib/*-linux-gnu*/libpthread.so.0 /lib/*-linux-gnu*/libpthread-2.*.so \
Expand All @@ -31,9 +36,6 @@ RUN apt update && apt install -y libncurses5 libstdc++6 libtinfo5 apt-utils ca-c
ln -s /usr/lib /tmp/lib_link/lib64 && \
ln -s /usr/lib /tmp/lib_link/lib

# Build the app.
RUN CGO_ENABLED=1 make clean ${BINARY}.${TARGETARCH}.${TARGETOS}

FROM scratch
ARG TARGETOS
ARG TARGETARCH
Expand Down
16 changes: 16 additions & 0 deletions init/docker/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ eval "docker buildx build --load --tag current:arm64 --platform linux/arm64/v8 $
eval "docker buildx build --load --tag current:arm --platform linux/arm $BUILD_ARGS"
echo "Done Building."


TAGS="$SOURCE_BRANCH"
if [ "v$VERSION" = "$SOURCE_BRANCH" ]; then
TAGS="$VERSION"

echo $SOURCE_BRANCH | grep -q -- -
if [ "$?" = "1" ]; then
# tag does not contain a dash, so assume it's a prod tag.
TAGS="$TAGS latest stable $(echo $VERSION | cut -d. -f1,2) $(echo $VERSION | cut -d. -f1)"
fi
fi

for tag in $TAGS; do
echo "Pushing tag: $DOCKER_REPO:$tag"
eval "docker buildx build --push --tag $DOCKER_REPO:$tag --platform linux/amd64,linux/arm64/v8,linux/arm $BUILD_ARGS"
done
22 changes: 1 addition & 21 deletions init/docker/hooks/push
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
#!/usr/bin/env bash

pushd ../..
source settings.sh

TAGS="$SOURCE_BRANCH"
if [ "v$VERSION" = "$SOURCE_BRANCH" ]; then
TAGS="$VERSION"

echo $SOURCE_BRANCH | grep -q -- -
if [ "$?" = "1" ]; then
# tag does not contain a dash, so assume it's a prod tag.
TAGS="$TAGS latest stable $(echo $VERSION | cut -d. -f1,2) $(echo $VERSION | cut -d. -f1)"
fi
fi


for tag in $TAGS; do
echo "Pushing tag: $DOCKER_REPO:$tag"
docker buildx build --push --platform linux/amd64,linux/arm64/v8,linux/arm -t $DOCKER_REPO:$tag --file ${DOCKERFILE_PATH} .
done

#empty

0 comments on commit d7cf394

Please sign in to comment.