Skip to content

Commit 3068d27

Browse files
authored
Merge pull request #737 from erizocosmico/feature/mysql-client
dockerfile: include zero-config mysql client
2 parents 0a56208 + 4c568c6 commit 3068d27

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Dockerfile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,25 @@ RUN make static-build
2020
#=================================
2121
FROM alpine:3.8
2222

23+
RUN apk add --no-cache mysql-client
24+
2325
RUN mkdir -p /opt/repos
2426

25-
ENV GITBASE_USER=root
26-
ENV GITBASE_PASSWORD=""
27-
ENV GITBASE_REPOS=/opt/repos
2827
EXPOSE 3306
2928

3029
ENV TINI_VERSION v0.18.0
3130
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-amd64 /tini
3231
RUN chmod +x /tini
3332
ENTRYPOINT ["/tini", "--"]
3433

34+
ENV GITBASE_USER=root
35+
ENV GITBASE_PASSWORD=""
36+
ENV GITBASE_REPOS=/opt/repos
37+
ENV MYSQL_HOST=127.0.0.1
38+
3539
# copy build artifacts
3640
COPY --from=builder /bin/gitbase /bin/gitbase
41+
ADD init.sh ./init.sh
42+
RUN chmod +x ./init.sh
3743

38-
CMD /bin/gitbase server -v \
39-
--host=0.0.0.0 \
40-
--port=3306 \
41-
--user="$GITBASE_USER" \
42-
--password="$GITBASE_PASSWORD" \
43-
--directories="$GITBASE_REPOS"
44+
ENTRYPOINT ["./init.sh"]

init.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
cat <<EOT >> "$HOME/.my.cnf"
4+
[client]
5+
user=${GITBASE_USER}
6+
password=${GITBASE_PASSWORD}
7+
EOT
8+
9+
/tini -s -- /bin/gitbase server -v \
10+
--host=0.0.0.0 \
11+
--port=3306 \
12+
--user="$GITBASE_USER" \
13+
--password="$GITBASE_PASSWORD" \
14+
--directories="$GITBASE_REPOS"

0 commit comments

Comments
 (0)