Update the dev dockerfile and build dockerfile to fix #60

This commit is contained in:
Gabe Kangas 2020-07-14 17:42:06 -07:00
parent a7a9ae0984
commit 738570563e
4 changed files with 27 additions and 13 deletions

View File

@ -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
run: docker run -p 8080:8080 -p 1935:1935 owncast

View File

@ -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"]

View File

@ -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"]
CMD ["/app/owncast", "-enableVerboseLogging"]

View File

@ -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