Add docker
This commit is contained in:
parent
51cd465887
commit
2cb899d79c
21
.drone.yml
21
.drone.yml
@ -29,6 +29,16 @@ steps:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: azlux/botamusique
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
tags: testing
|
||||
|
||||
- name: deploy-stable
|
||||
image: debian
|
||||
@ -43,6 +53,17 @@ steps:
|
||||
- master
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: azlux/botamusique
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
tags: latest
|
||||
|
||||
|
||||
volumes:
|
||||
- name: repo
|
||||
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM python:slim
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
EXPOSE 8181
|
||||
|
||||
RUN apt update && \
|
||||
apt install -y opus-tools ffmpeg libmagic-dev curl tar && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY . /botamusique
|
||||
|
||||
WORKDIR /botamusique
|
||||
|
||||
RUN rm -rf .git*
|
||||
|
||||
RUN python3 -m venv venv && \
|
||||
venv/bin/pip install wheel && \
|
||||
venv/bin/pip install -r requirements.txt
|
||||
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/botamusique/entrypoint.sh" ]
|
||||
CMD ["venv/bin/python", "mumbleBot.py"]
|
52
entrypoint.sh
Normal file
52
entrypoint.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
command=( "${@}" )
|
||||
|
||||
if [ -n "$BAM_DB" ]; then
|
||||
command+=( "--db" "$BAM_DB" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_MUSIC_DB" ]; then
|
||||
command+=( "--music-db" "$BAM_MUSIC_DB" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_MUMBLE_SERVER" ]; then
|
||||
command+=( "--server" "$BAM_MUMBLE_SERVER")
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_MUMBLE_PASSWORD" ]; then
|
||||
command+=( "--password" "$BAM_MUMBLE_PASSWORD" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_MUMBLE_PORT" ]; then
|
||||
command+=( "--port" "$BAM_MUMBLE_PORT" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_USER" ]; then
|
||||
command+=( "--user" "$BAM_USER" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_TOKENS" ]; then
|
||||
command+=( "--tokens" "$BAM_TOKENS" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_CHANNEL" ]; then
|
||||
command+=( "--channel" "$BAM_CHANNEL" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_CERTIFICATE" ]; then
|
||||
command+=( "--cert" "$BAM_CERTIFICATE" )
|
||||
fi
|
||||
|
||||
if [ -n "$BAM_CONFIG_file" ]; then
|
||||
if [ ! -f "$BAM_CONFIG_file" ]; then
|
||||
cp "/botamusique/configuration.example.ini" "$BAM_CONFIG_file"
|
||||
fi
|
||||
command+=( "--config" "$BAM_CONFIG_file" )
|
||||
else
|
||||
if [ ! -f "/botamusique/configuration.ini" ]; then
|
||||
cp "/botamusique/configuration.example.ini" "/botamusique/configuration.ini"
|
||||
fi
|
||||
command+=( "--config" "/botamusique/configuration.ini" )
|
||||
fi
|
||||
|
||||
exec "${command[@]}"
|
Loading…
x
Reference in New Issue
Block a user