Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GoIP server #269

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/goip/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM debian:stable-slim AS bootstrap

ENV DEBIAN_FRONTEND noninteractive

WORKDIR /tmp

RUN apt-get -y update -qq && apt-get -y install default-mysql-client

RUN rm -rf /var/lib/apt/lists/*

COPY bootstrap/goipinit.sql .
COPY bootstrap/bootstrap.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bootstrap"]

FROM debian:stable-slim

WORKDIR /tmp

RUN apt-get -y update -qq && apt-get -y install libmariadb-dev-compat
RUN ln -s /usr/lib/x86_64-linux-gnu/libmariadb.so.3 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18

RUN apt-get -y install procps # for ps command. Remove this later

RUN rm -rf /var/lib/apt/lists/*

COPY goipcron_x64 /usr/local/bin/goipcron
COPY docker-entrypoint.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["goip"]
19 changes: 19 additions & 0 deletions components/goip/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -e

if [ "$1" = 'bootstrap' ]; then
DATABASE_USERNAME="${DATABASE_USERNAME:="root"}"
DATABASE_PASSWORD="${DATABASE_PASSWORD:=""}"
DATABASE_HOST="${DATABASE_HOST:="host.docker.internal"}"
DATABASE_PORT="${DATABASE_PORT:="3306"}"
DATABASE_INIT_SCRIPT="${DATABASE_INIT_SCRIPT:="goipinit.sql"}"

if [ -n "$DATABASE_PASSWORD" ]; then
mysql -u $DATABASE_USERNAME -p'$DATABASE_PASSWORD' -h $DATABASE_HOST -P $DATABASE_PORT < $DATABASE_INIT_SCRIPT
else
mysql -u $DATABASE_USERNAME -h $DATABASE_HOST -P $DATABASE_PORT < $DATABASE_INIT_SCRIPT
fi
else
exec "$@"
fi
Loading