Skip to content

Commit fef5b64

Browse files
Merge pull request #48 from serlo/zip-sql
Compress dump
2 parents 233d15a + a836274 commit fef5b64

File tree

8 files changed

+14
-12
lines changed

8 files changed

+14
-12
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker-entrypoint-initdb.d

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends pv git-lfs \
55
&& rm -rf /var/lib/apt/lists/* \
66
# Clear out the local repository of retrieved package files
77
&& apt-get clean
8-
COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d
8+
9+
COPY docker-entrypoint-initdb.tar .
10+
11+
RUN tar -xvzf docker-entrypoint-initdb.tar
12+
913
COPY conf.d/mysqld.cnf /etc/mysql/conf.d
1014
# The entrypoint script will not run when `serlo.cnf` is in /etc/mysql/conf.d
1115
# as well. Thus we store it in another place and use the `serlo-mysql`

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ help:
88
@echo "mysql – Connect to local MySQL server with a shell"
99
@echo "rollback – Rollback to local '.sql' file"
1010

11-
up:
11+
up: unzip
1212
docker compose up --build --detach
1313

1414
down:
@@ -19,6 +19,12 @@ dump:
1919
--lock-all-tables --default-character-set=utf8mb4 \
2020
--databases serlo > docker-entrypoint-initdb.d/001-init.sql
2121

22+
zip:
23+
tar -zcvf docker-entrypoint-initdb.tar docker-entrypoint-initdb.d
24+
25+
unzip:
26+
tar -xvzf docker-entrypoint-initdb.tar
27+
2228
mysql:
2329
docker compose exec -it mysql serlo-mysql
2430

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ This repository contains a custom `mysql` docker image. Changes we have made:
77
- The command line tool `pv` is available as well. It provides a progress bar
88
when a `.sql` file is imported. Usage: `pv file.sql | serlo-mysql`
99

10-
## Requirements
11-
- Docker
12-
- [Git LFS](https://github.com/git-lfs/git-lfs)
13-
1410
## Change DB via migrations
1511

1612
In order to change the DB image via DB migrations do the following:
1713

1814
1. Run MySQL DB in this repository with `make up`.
1915
2. Run DB migrations
2016
3. Check the changes in the DB via `make mysql`.
21-
4. Make a new dump via `make dump` and commit your changes.
17+
4. Make a new dump via `make dump` and `make zip` and commit your changes.
2218

2319
## Publish Image
2420

docker-entrypoint-initdb.d/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-entrypoint-initdb.d/001-init.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

docker-entrypoint-initdb.tar

17.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)