diff --git a/.github/workflows/buildmaster.yaml b/.github/workflows/buildmaster.yaml index dcdf62c12..ceb544f41 100644 --- a/.github/workflows/buildmaster.yaml +++ b/.github/workflows/buildmaster.yaml @@ -30,8 +30,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Build Docker image - run: docker build . --tag test-docker-image-build + - name: Copy default config file + run: cp config-example.yaml config.yaml + + - name: Build Docker image + run: docker build -t owncast . + - name: Run Docker image - run: docker run -p 8080:8080 -p 1935:1935 test-docker-image-build \ No newline at end of file + run: docker run -p 8080:8080 -p 1935:1935 owncast \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ca4ba6ddb..fa5fde193 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ RUN mkdir /app ADD . /app WORKDIR /app RUN apk add --no-cache ffmpeg ffmpeg-libs -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o owncast . +RUN apk update && apk add --no-cache gcc build-base linux-headers +RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o owncast . WORKDIR /app CMD ["/app/owncast"] \ No newline at end of file diff --git a/scripts/Dockerfile-build b/scripts/Dockerfile-build index 46ca76047..7ba3af348 100644 --- a/scripts/Dockerfile-build +++ b/scripts/Dockerfile-build @@ -2,9 +2,18 @@ FROM golang:alpine EXPOSE 8080 1935 RUN mkdir /app ADD . /app -COPY ./config-example.yaml /app/config.yaml WORKDIR /app RUN apk add --no-cache ffmpeg ffmpeg-libs -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o owncast . +RUN apk update && apk add --no-cache gcc build-base linux-headers + +ARG VERSION +ENV VERSION=${VERSION} +ARG GIT_COMMIT +ENV GIT_COMMIT=${GIT_COMMIT} +ARG NAME +ENV NAME=${NAME} + +RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags "-extldflags \"-static\" -X main.GitCommit=$GIT_COMMIT -X main.BuildVersion=$VERSION -X main.BuildType=$NAME" -o owncast . + WORKDIR /app -CMD ["/app/owncast", "-enableVerboseLogging"] \ No newline at end of file +CMD ["/app/owncast", "-enableVerboseLogging"] diff --git a/scripts/build.sh b/scripts/build.sh index 5dab6649a..91a7097c0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -60,9 +60,9 @@ build() { rm -rf dist/${NAME}/ } -for i in "${!DISTRO[@]}"; do - build ${DISTRO[$i]} ${OS[$i]} ${ARCH[$i]} $VERSION $GIT_COMMIT -done +# for i in "${!DISTRO[@]}"; do +# build ${DISTRO[$i]} ${OS[$i]} ${ARCH[$i]} $VERSION $GIT_COMMIT +# done # Create the tag # git tag -a "v${VERSION}" -m "Release build v${VERSION}" @@ -77,10 +77,10 @@ done # Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages # DOCKER_IMAGE="owncast-${VERSION}" # echo "Building Docker image ${DOCKER_IMAGE}..." - +# # # Change to the root directory of the repository # cd $(git rev-parse --show-toplevel) - -# docker build -t owncast . -t="${DOCKER_IMAGE}" -f scripts/Dockerfile-build +# +# docker build --build-arg NAME=docker --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$GIT_COMMIT -t owncast . -f scripts/Dockerfile-build # docker tag $DOCKER_IMAGE docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION # docker push docker.pkg.github.com/gabek/owncast/$DOCKER_IMAGE:$VERSION