forked from FAForever/db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.87 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM mysql:5.7.18
ENV FLYWAY_VERSION 4.0.3
# Install mysql_config which allows to set up a no-password login with --login-path
RUN apt-get update -y --force-yes > /dev/null && apt-get install -y --force-yes libmysqlclient-dev wget > /dev/null
# Download flyway
RUN wget -q http://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz \
&& tar xzf flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz \
&& rm flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz \
&& mv flyway-${FLYWAY_VERSION} flyway \
&& chmod +x flyway/flyway
RUN chown -R mysql /flyway
# Download MariaDB driver (compatible with MySQL but supports local sockets
RUN wget -q http://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.7/mariadb-java-client-1.5.7.jar -O flyway/drivers/mariadb-java-client-1.5.7.jar
# Download JNA which is needed for local socket support of the MariaDB driver
RUN wget -q http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.3.0/jna-4.3.0.jar -O flyway/drivers/jna-4.3.0.jar
COPY healthcheck.sh /
RUN chmod +x healthcheck.sh
HEALTHCHECK --interval=30s --timeout=5s --retries=5 CMD ["./healthcheck.sh"]
# Copy init scripts which will be executed automatically if the database doesn't exist yet
COPY init/* /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/*.sh
# Copy migration scripts
COPY migrate.sh /
RUN chmod +x migrate.sh
COPY migrations/* /flyway/sql/
# Copy dump script
COPY dump-structure.sh /
RUN chmod +x dump-structure.sh
# Copy test data for CI
COPY test-data.sql /
# Copy pre-init script
COPY pre-entry.sh /usr/local/bin/docker-pre-entry.sh
RUN chmod +x /usr/local/bin/docker-pre-entry.sh
ENTRYPOINT ["docker-pre-entry.sh"]
# CMD has to be specified again after new ENTRYPOINT (https://docs.docker.com/engine/reference/builder/#entrypoint)
CMD ["mysqld"]
EXPOSE 3306