Skip to content

Commit

Permalink
Updated temporary database structure directory on host.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Dec 2, 2024
1 parent a8028fe commit 64341b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To ignore OS temporary files use global .gitignore
# https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer

.data
.db-structure
.logs
coverage
16 changes: 8 additions & 8 deletions seed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ DESTINATION_PLATFORMS="${DESTINATION_PLATFORMS:-linux/amd64,linux/arm64}"
# Log directory on host to store container logs.
LOG_DIR="${LOG_DIR:-.logs}"

# Temporary data directory on host.
TMP_DATA_DIR="${TMP_DATA_DIR:-.data}"
# Temporary database structure directory on host.
TMP_STRUCTURE_DIR="${TMP_STRUCTURE_DIR:-.db-structure}"

# Show verbose output.
LOG_IS_VERBOSE="${LOG_IS_VERBOSE:-}"
Expand Down Expand Up @@ -169,8 +169,8 @@ info "Started database seeding."
rm -Rf "${LOG_DIR}" >/dev/null
mkdir -p "${LOG_DIR}" >/dev/null

rm -Rf "${TMP_DATA_DIR}" >/dev/null
mkdir -p "${TMP_DATA_DIR}" >/dev/null
rm -Rf "${TMP_STRUCTURE_DIR}" >/dev/null
mkdir -p "${TMP_STRUCTURE_DIR}" >/dev/null

if [ "$(uname -m)" = "arm64" ]; then
export DOCKER_DEFAULT_PLATFORM=linux/amd64
Expand Down Expand Up @@ -211,9 +211,9 @@ docker exec "${cid}" bash -c "chown -R mysql /home/db-data && /bin/fix-permissio
pass "Updated permissions on the seeded database files."

task "Copy expanded database files to host"
mkdir -p "${TMP_DATA_DIR}"
docker cp "${cid}":/home/db-data/. "${TMP_DATA_DIR}/" >/dev/null
[ ! -d "${TMP_DATA_DIR}/mysql" ] && fail "Unable to copy expanded database files to host " && ls -al "${TMP_DATA_DIR}" && exit 1
mkdir -p "${TMP_STRUCTURE_DIR}"
docker cp "${cid}":/home/db-data/. "${TMP_STRUCTURE_DIR}/" >/dev/null
[ ! -d "${TMP_STRUCTURE_DIR}/mysql" ] && fail "Unable to copy expanded database files to host " && ls -al "${TMP_STRUCTURE_DIR}" && exit 1
pass "Copied expanded database files to host"

stop_container "${cid}"
Expand All @@ -224,7 +224,7 @@ task "Build image ${DST_IMAGE} for ${DESTINATION_PLATFORMS} platform(s) from ${B
cat <<EOF | docker buildx build --no-cache --build-arg="BASE_IMAGE=${BASE_IMAGE}" --platform "${DESTINATION_PLATFORMS}" --tag "${DST_IMAGE}" --push -f - .
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
COPY --chown=mysql:mysql .data /home/db-data/
COPY --chown=mysql:mysql ${TMP_STRUCTURE_DIR} /home/db-data/
USER root
RUN /bin/fix-permissions /home/db-data
USER mysql
Expand Down

0 comments on commit 64341b7

Please sign in to comment.