fix docker build (#7)
This commit is contained in:
parent
4b1c801370
commit
1f618201f9
3 changed files with 69 additions and 18 deletions
71
Dockerfile
71
Dockerfile
|
@ -1,19 +1,70 @@
|
||||||
FROM golang:alpine
|
FROM golang:bookworm
|
||||||
|
|
||||||
RUN apk update && \
|
ARG FFMPEG_VERSION=7.1
|
||||||
apk upgrade && \
|
ARG LIBHEIF_VERSION=1.19.7
|
||||||
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
|
|
||||||
ffmpeg \
|
RUN apt-get update && \
|
||||||
libheif \
|
apt-get upgrade -y && \
|
||||||
libheif-dev \
|
apt-get install -y --no-install-recommends \
|
||||||
bash \
|
bash \
|
||||||
git \
|
git \
|
||||||
pkgconfig \
|
pkg-config \
|
||||||
build-base
|
build-essential \
|
||||||
|
tar \
|
||||||
|
wget \
|
||||||
|
xz-utils \
|
||||||
|
gcc \
|
||||||
|
cmake \
|
||||||
|
libde265-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# libheif
|
||||||
|
ENV LIBHEIF_BUILD="https://github.com/strukturag/libheif/releases/download/v${LIBHEIF_VERSION}/libheif-${LIBHEIF_VERSION}.tar.gz"
|
||||||
|
RUN wget -O libheif.tar.gz ${LIBHEIF_BUILD} && \
|
||||||
|
mkdir -p libheif && \
|
||||||
|
tar -xzvf libheif.tar.gz -C libheif --strip-components=1 && \
|
||||||
|
rm libheif.tar.gz && \
|
||||||
|
cd libheif && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake --preset=release .. && \
|
||||||
|
make && \
|
||||||
|
make install
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
RUN mkdir -p \
|
||||||
|
/usr/local/bin \
|
||||||
|
/usr/local/lib/pkgconfig/ \
|
||||||
|
/usr/local/lib/ \
|
||||||
|
/usr/local/include
|
||||||
|
|
||||||
|
RUN ARCH=$(uname -m) && \
|
||||||
|
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
|
||||||
|
echo "detected ARM architecture" && \
|
||||||
|
export FFMPEG_BUILD="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n${FFMPEG_VERSION}-latest-linuxarm64-gpl-shared-${FFMPEG_VERSION}.tar.xz"; \
|
||||||
|
else \
|
||||||
|
echo "detected x86_64 architecture" && \
|
||||||
|
export FFMPEG_BUILD="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n${FFMPEG_VERSION}-latest-linux64-gpl-shared-${FFMPEG_VERSION}.tar.xz"; \
|
||||||
|
fi && \
|
||||||
|
wget -O ffmpeg.tar.xz ${FFMPEG_BUILD} && \
|
||||||
|
mkdir -p ffmpeg && \
|
||||||
|
tar -xf ffmpeg.tar.xz -C ffmpeg --strip-components=1 && \
|
||||||
|
rm ffmpeg.tar.xz && \
|
||||||
|
cp -rv ffmpeg/bin/* /usr/local/bin/ && \
|
||||||
|
cp -rv ffmpeg/lib/* /usr/local/lib/ && \
|
||||||
|
cp -rv ffmpeg/include/* /usr/local/include/ && \
|
||||||
|
cp -rv ffmpeg/lib/pkgconfig/* /usr/local/lib/pkgconfig/ && \
|
||||||
|
ldconfig /usr/local
|
||||||
|
|
||||||
|
# env for building
|
||||||
|
ENV CGO_CFLAGS="-I/usr/local/include"
|
||||||
|
ENV CGO_LDFLAGS="-L/usr/local/lib"
|
||||||
|
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
|
||||||
|
|
||||||
WORKDIR /bot
|
WORKDIR /bot
|
||||||
|
|
||||||
RUN mkdir downloads
|
RUN mkdir -p downloads
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ _this method only works on linux and macos, if you want to build the bot on wind
|
||||||
```
|
```
|
||||||
|
|
||||||
## docker (recommended)
|
## docker (recommended)
|
||||||
> [!WARNING]
|
|
||||||
> this method is currently not working due to a wrong version of the libav (ffmpeg) library in the docker image. feel free to open a PR if you can fix it.
|
|
||||||
|
|
||||||
1. build the image using the dockerfile:
|
1. build the image using the dockerfile:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
services:
|
services:
|
||||||
govd-bot:
|
govd-bot:
|
||||||
image: govd-bot
|
image: govd-bot
|
||||||
|
container_name: govd-bot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- govd-network
|
- govd-network
|
||||||
|
@ -10,13 +11,14 @@ services:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mysql
|
image: mariadb:latest
|
||||||
|
container_name: mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: govd
|
MARIADB_DATABASE: govd
|
||||||
MYSQL_USER: govd
|
MARIADB_USER: govd
|
||||||
MYSQL_PASSWORD: password
|
MARIADB_PASSWORD: password
|
||||||
MYSQL_ROOT_PASSWORD: example
|
MARIADB_ROOT_PASSWORD: example
|
||||||
networks:
|
networks:
|
||||||
- govd-network
|
- govd-network
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue