Skip to content

Commit

Permalink
Merge branch 'main' into refactor/building_upgrade_requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Vianpyro committed Nov 20, 2024
2 parents d305e67 + d262dd2 commit 836e44d
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@ FROM mariadb:11.5.2

# Set environment variables
ENV TZ=America/Montreal
ENV TEMP_SQL_DIR=/temp-sql-files

# Set the shell for safer execution
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Create a non-root user and group
RUN groupadd -r dbuser && useradd -r -g dbuser dbuser

# Copy SQL files and set ownership
COPY *.sql /docker-entrypoint-initdb.d/
# Copy all files into a temporary location
COPY . ${TEMP_SQL_DIR}/

# Flatten the directory structure and rename files to include folder names
RUN find "${TEMP_SQL_DIR:?}/" -type f -name "*.sql" | while read -r file; do \
new_name=$(echo "$file" | sed "s|${TEMP_SQL_DIR:?}/||" | sed 's|/|_|g' | sed 's|^_||'); \
cp "$file" "/docker-entrypoint-initdb.d/$new_name"; \
done && \
rm -rf "${TEMP_SQL_DIR:?}/"

# Set ownership
RUN chown -R dbuser:dbuser /docker-entrypoint-initdb.d

# Ensure proper permissions for MariaDB directories
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion procedures_get_city.sql → procedures/get/city.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE OR REPLACE PROCEDURE get_city_by_id(IN p_city_id INT)
BEGIN
SELECT city_id, city_name, island_id, owner_id
FROM city
WHERE id = p_city_id;
WHERE city_id = p_city_id;
END //

CREATE OR REPLACE PROCEDURE get_city_buildings(IN p_city_id INT)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 836e44d

Please sign in to comment.