yeah i forgot to push the important files
This commit is contained in:
parent
b72615db63
commit
e199bbbca4
2 changed files with 46 additions and 15 deletions
57
Dockerfile
57
Dockerfile
|
@ -1,29 +1,62 @@
|
||||||
# syntax=docker/dockerfile:1
|
## syntax=docker/dockerfile:1
|
||||||
FROM golang:1.20-alpine
|
#build container
|
||||||
|
FROM golang:1.21-alpine3.18 as build
|
||||||
WORKDIR /tmp/build
|
WORKDIR /tmp/build
|
||||||
|
|
||||||
#install update system and install packages
|
ARG TARGETPLATFORM TARGETOS TARGETARCH BUILDOS BUILDARCH
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
RUN apk upgrade --available
|
RUN apk upgrade --available
|
||||||
RUN apk add alpine-sdk ffmpeg python3 py3-pip
|
RUN apk add alpine-sdk tar xz
|
||||||
|
|
||||||
#install yt-dlp
|
|
||||||
RUN pip3 install yt-dlp
|
|
||||||
|
|
||||||
#build bloaterbot
|
#build bloaterbot
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN mkdir /tmp/build/output
|
||||||
|
|
||||||
ARG CGO_ENABLED=1
|
ARG CGO_ENABLED=1
|
||||||
|
|
||||||
ENV COMMIT=${COMMIT}
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
RUN go build -o /app/bloaterbot
|
RUN go build -o /tmp/build/output/bloaterbot
|
||||||
|
|
||||||
|
#download ffmpeg and yt-dlp
|
||||||
|
|
||||||
|
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||||
|
wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" -O "/tmp/ffmpeg.tar.xz" && wget "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux" -O "/tmp/yt-dlp" && go build -o /tmp/build/output/bloaterbot; \
|
||||||
|
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||||
|
wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz" -O "/tmp/ffmpeg.tar.xz" && wget "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_aarch64" -O "/tmp/yt-dlp" && go build -o /tmp/build/output/bloaterbot; \
|
||||||
|
else \
|
||||||
|
echo "ERROR! Invalid build target" && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN mkdir /tmp/ffmpeg
|
||||||
|
RUN tar -xvf /tmp/ffmpeg.tar.xz -C /tmp/ffmpeg --strip-components=1
|
||||||
|
|
||||||
|
|
||||||
|
#final container
|
||||||
|
FROM alpine:3.18
|
||||||
|
|
||||||
|
#update system and install packages
|
||||||
|
RUN apk update
|
||||||
|
RUN apk upgrade --available
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN rm -rf /tmp/build
|
COPY --from=build /tmp/build/output/bloaterbot /app/bloaterbot
|
||||||
COPY bloater.webp /app
|
|
||||||
|
|
||||||
CMD [ "/app/bloaterbot" ]
|
COPY --from=build /tmp/ffmpeg/ffmpeg /usr/local/bin/ffmpeg
|
||||||
|
COPY --from=build /tmp/yt-dlp /usr/local/bin/yt-dlp
|
||||||
|
RUN chmod +x /usr/local/bin/yt-dlp /usr/local/bin/ffmpeg
|
||||||
|
|
||||||
|
|
||||||
|
COPY bloater.webp /app/bloater.webp
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
|
||||||
|
RUN chmod -x /app/entrypoint.sh
|
||||||
|
|
||||||
|
CMD ["/bin/ash", "/app/entrypoint.sh"]
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -1,10 +1,8 @@
|
||||||
###!/usr/bin/env bash
|
###!/usr/bin/env bash
|
||||||
docker login
|
|
||||||
|
|
||||||
read -p 'Tag: ' tag
|
read -p 'Tag: ' tag
|
||||||
|
|
||||||
|
|
||||||
docker buildx create --name bloaterbuilder --use --bootstrap
|
docker build --tag watn3y/bloaterbot:$(git log -1 --pretty=%h) --tag watn3y/bloaterbot:$tag --build-arg=COMMIT=$(git log -1 --pretty=%h) .
|
||||||
docker buildx build --push --platform linux/amd64,linux/arm64 --tag watn3y/bloaterbot:$(git log -1 --pretty=%h) --tag watn3y/bloaterbot:$tag --build-arg=COMMIT=$(git log -1 --pretty=%h) .
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue