This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: update workflows * build: depend on tests to pass
- Loading branch information
Showing
2 changed files
with
176 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# build app | ||
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 AS app-builder | ||
RUN apk add --no-cache git tzdata | ||
|
||
ENV SERVICE=omegabrr | ||
|
||
WORKDIR /src | ||
|
||
# Cache Go modules | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . ./ | ||
|
||
ARG VERSION=dev | ||
ARG REVISION=dev | ||
ARG BUILDTIME | ||
ARG TARGETOS TARGETARCH TARGETVARIANT | ||
|
||
RUN --network=none --mount=target=. \ | ||
export GOOS=$TARGETOS; \ | ||
export GOARCH=$TARGETARCH; \ | ||
[[ "$GOARCH" == "amd64" ]] && export GOAMD64=$TARGETVARIANT; \ | ||
[[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v6" ]] && export GOARM=6; \ | ||
[[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v7" ]] && export GOARM=7; \ | ||
echo $GOARCH $GOOS $GOARM$GOAMD64; \ | ||
go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${REVISION} -X main.date=${BUILDTIME}" -o /out/bin/omegabrr cmd/omegabrr/main.go | ||
|
||
# build runner | ||
FROM alpine:latest AS runner | ||
|
||
LABEL org.opencontainers.image.source = "https://github.com/autobrr/omegabrr" | ||
LABEL org.opencontainers.image.licenses = "MIT" | ||
LABEL org.opencontainers.image.base.name = "alpine:latest" | ||
|
||
ENV APP_DIR="/app" CONFIG_DIR="/config" PUID="1000" PGID="1000" UMASK="002" TZ="Etc/UTC" ARGS="" | ||
ENV XDG_CONFIG_HOME="${CONFIG_DIR}/.config" XDG_CACHE_HOME="${CONFIG_DIR}/.cache" XDG_DATA_HOME="${CONFIG_DIR}/.local/share" LANG="C.UTF-8" LC_ALL="C.UTF-8" | ||
|
||
VOLUME ["${CONFIG_DIR}"] | ||
|
||
RUN apk add --no-cache tzdata shadow bash curl wget jq grep sed coreutils findutils unzip p7zip ca-certificates | ||
|
||
COPY --from=app-builder /out/bin/omegabrr /usr/local/bin/ | ||
|
||
# make folders | ||
RUN mkdir "${APP_DIR}" && \ | ||
# create user | ||
useradd -u 1000 -U -d "${CONFIG_DIR}" -s /bin/false omegabrr && \ | ||
usermod -G users omegabrr | ||
|
||
WORKDIR /config | ||
|
||
EXPOSE 7441 | ||
|
||
ENTRYPOINT ["omegabrr", "run", "--config", "/config/config.yaml"] | ||
#CMD ["--config", "/config"] |