diff --git a/Dockerfile b/Dockerfile index 0a02676f8..7d15d8540 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,11 +20,10 @@ RUN make static-build #================================= FROM alpine:3.8 +RUN apk add --no-cache mysql-client + RUN mkdir -p /opt/repos -ENV GITBASE_USER=root -ENV GITBASE_PASSWORD="" -ENV GITBASE_REPOS=/opt/repos EXPOSE 3306 ENV TINI_VERSION v0.18.0 @@ -32,12 +31,14 @@ ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-stati RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] +ENV GITBASE_USER=root +ENV GITBASE_PASSWORD="" +ENV GITBASE_REPOS=/opt/repos +ENV MYSQL_HOST=127.0.0.1 + # copy build artifacts COPY --from=builder /bin/gitbase /bin/gitbase +ADD init.sh ./init.sh +RUN chmod +x ./init.sh -CMD /bin/gitbase server -v \ - --host=0.0.0.0 \ - --port=3306 \ - --user="$GITBASE_USER" \ - --password="$GITBASE_PASSWORD" \ - --directories="$GITBASE_REPOS" +ENTRYPOINT ["./init.sh"] diff --git a/init.sh b/init.sh new file mode 100644 index 000000000..54e0967fd --- /dev/null +++ b/init.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +cat <> "$HOME/.my.cnf" +[client] +user=${GITBASE_USER} +password=${GITBASE_PASSWORD} +EOT + +/tini -s -- /bin/gitbase server -v \ + --host=0.0.0.0 \ + --port=3306 \ + --user="$GITBASE_USER" \ + --password="$GITBASE_PASSWORD" \ + --directories="$GITBASE_REPOS" \ No newline at end of file