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

dockerfile: include zero-config mysql client #737

Merged
merged 3 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@ RUN go build -ldflags="-X main.version=$(cat version.txt || echo "undefined") -X
#=================================
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
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-amd64 /tini
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"]
14 changes: 14 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

cat <<EOT >> "$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"