Compare commits

..

14 Commits

Author SHA1 Message Date
94e0054075 Change domain to new one
Some checks failed
Run Go Tests / Run Tests (pull_request) Has been cancelled
2025-02-14 00:34:12 -05:00
dfb7011dc3 Point docker build to Dockerfile.builder in workflow
Some checks failed
Run Go Tests / Run Tests (pull_request) Has been cancelled
2025-02-14 00:33:34 -05:00
9b5ea0f41a Remove unused workflow
Some checks failed
Run Go Tests / Run Tests (pull_request) Has been cancelled
2025-02-14 00:29:32 -05:00
0ed9bb1cef Add .old back into the .gitignore
Some checks failed
Run Go Tests / Run Tests (pull_request) Has been cancelled
2025-02-14 00:27:50 -05:00
e58b636856 Remove old Dockerfile
All checks were successful
Run Go Tests / Run Tests (pull_request) Successful in 11m37s
2025-02-14 00:25:18 -05:00
381bfb32b2 Merge branch 'master' of ssh://prod1:2222/thegrind/papibot into Dockerfile
Bringing in Javi's changes to master.
2025-02-14 00:15:52 -05:00
b86c11e81d Clean up dockerfiles 2025-02-14 00:14:30 -05:00
d6ebe0f0e5 Dockerize the build process
Add docker build commands to README

Clean up Dockerfile.runtime
2025-02-13 23:54:20 -05:00
aced
0d30bae2d8 added small section for docker in the readme 2025-02-05 05:36:45 -05:00
aced
9db97ab6db added small section for docker in the readme 2025-02-05 05:35:06 -05:00
aced
fe75a2c36f added detailed comments, would still need to clean some of the packages. (tried theres errors as soon you remove some) 2025-02-05 05:25:03 -05:00
aced
369a057a7a Added detailed comments for the Dockerfile 2025-02-05 05:05:53 -05:00
aced
9fe4e2fad1 Dockerfile created. Final docker image includes ffmpeg-6.0.1 and yt-dl 2025.01.26 2025-02-05 05:01:21 -05:00
aced
baee73e7a3 Dockerfile created. Final docker image includes ffmpeg-6.0.1 and yt-dl 2025.01.26 2025-02-05 04:59:45 -05:00
5 changed files with 156 additions and 2 deletions

View File

@ -0,0 +1,47 @@
name: Container Build & Push
# add on pull requests too
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
REGISTRY: gitgud.foo
OWNER: thegrind
TAG: 1.0.0
IMAGE_NAME: test
steps:
-
name: Check out code
uses: actions/checkout@v3
- name: whereami
run: ls -lath
-
name: get dicks space
run: |
df -h
-
name: Log in to the GitGud container registry
run: |
/usr/bin/docker login $REGISTRY \
-u "${{ gitea.actor }}" \
-p "${{ secrets.REGISTRY_PASSWORD }}"
-
name: Build and push OCI image
run: |
IMAGE=$REGISTRY/$OWNER/$IMAGE_NAME:$TAG
docker build -f Dockerfile.builder -t $IMAGE .
-
name: Push OCI image
run: |
IMAGE=$REGISTRY/$OWNER/$IMAGE_NAME:$TAG
docker push $IMAGE

4
.gitignore vendored
View File

@ -5,4 +5,6 @@ output.opus
.env .env
*.wav *.wav
*.opus *.opus
*.webm *.webm
*.tar.gz
*.old

78
Dockerfile.builder Normal file
View File

@ -0,0 +1,78 @@
# Use the official golang:1.22.12-bookworm image as the build stage
FROM golang:1.22.12-bookworm
# Create a directory /app
RUN mkdir /app
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into /app
COPY ./ /app/
# Update the package list and install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
wget \
vim \
git \
debconf \
ca-certificates \
tar \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
yasm \
zlib1g-dev \
libx264-dev \
libx265-dev \
libnuma-dev \
libvpx-dev \
libopus-dev \
libunistring-dev \
libaom-dev \
libdav1d-dev && \
# Download Go module dependencies
go mod download && \
# Download yt-dlp
wget --no-check-certificate -c https://github.com/yt-dlp/yt-dlp/releases/download/2025.01.26/yt-dlp_linux &&\
# Download ffmpeg
wget --no-check-certificate -c https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-6.0.1-amd64-static.tar.xz &&\
# Move yt-dlp to /usr/bin and set permissions
mv yt-dlp_linux /usr/bin/yt-dlp && \
chmod 755 /usr/bin/yt-dlp && \
chmod +x /usr/bin/yt-dlp && \
# Extract ffmpeg tarball
tar -xf ffmpeg-6.0.1-amd64-static.tar.xz && \
# Remove the tarball
rm -rf ffmpeg-6.0.1-amd64-static.tar.xz && \
# Set execute permissions for ffmpeg and ffprobe
chmod +x ffmpeg-6.0.1-amd64-static/ffmpeg && \
chmod +x ffmpeg-6.0.1-amd64-static/ffprobe && \
# Copy ffmpeg and ffprobe to /usr/bin
cp -R ffmpeg-6.0.1-amd64-static/ffmpeg /usr/bin/ && \
cp -R ffmpeg-6.0.1-amd64-static/ffprobe /usr/bin/ && \
# Remove the extracted ffmpeg directory
rm -rf ffmpeg-6.0.1-amd64-static && \
# Create a new user 'papibot'
useradd papibot && \
# Build the Go application
CGO_ENABLED=0 GOOS=linux go build -o /app/papibot

17
Dockerfile.runtime Normal file
View File

@ -0,0 +1,17 @@
FROM www.gitgud.foo/thegrind/papibot-builder:latest as build
# Create a group and user 'papibot'
RUN groupadd -r papibot && useradd -r -g papibot papibot
# Switch to the 'papibot' user
USER papibot
# Copy the necessary files from the build stage
COPY --from=build --chown=papibot:papibot /usr/bin/ /usr/bin
COPY --from=build --chown=papibot:papibot /app/ /app/
# Set the working directory to /app
WORKDIR /app/
# Set the entry point to the built Go application
ENTRYPOINT ["./papibot"]

View File

@ -2,6 +2,11 @@
Currently in development. Currently in development.
## docker
docker build -t papibot . ;docker run -d papibot:latest --name papibot
## System requirements ## System requirements
- `ffmpeg` make sure libopus is included - `ffmpeg` make sure libopus is included
- `yt-dlp` - `yt-dlp`
@ -16,6 +21,11 @@ Populate the discord bot keys
type `!` in any channel in the discord while you're in a voice channel. type `!` in any channel in the discord while you're in a voice channel.
## Build new builder container image
```
docker build -t www.gitgud.foo/thegrind/papibot-builder:<tag> Dockerfile.builder
```
## Running tests locally ## Running tests locally
`make test` `make test`