-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b79443
commit 0d3cf9f
Showing
3 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
FROM flyway/flyway:10-alpine | ||
FROM flyway/flyway:11-alpine | ||
|
||
# Copy migrations | ||
COPY ./sql /flyway/sql | ||
|
||
# Non-root user | ||
RUN adduser -D app | ||
# Copy entrypoint script | ||
COPY entrypoint.sh /flyway/entrypoint.sh | ||
RUN chmod +x /flyway/entrypoint.sh | ||
|
||
# Set correct permissions for non-root user | ||
RUN adduser -D app && chown -R app:app /flyway/sql | ||
|
||
# Switch to non-root user | ||
USER app | ||
|
||
# Health check and startup | ||
HEALTHCHECK CMD info | ||
# Health check | ||
HEALTHCHECK CMD flyway info || exit 1 | ||
|
||
# Set the custom entrypoint | ||
ENTRYPOINT ["/flyway/entrypoint.sh"] | ||
|
||
# Default command | ||
CMD ["info", "migrate", "info"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Check APP_ENV and run flyway clean if it is set to 'dev' | ||
# FLYWAY_CLEAN_DISABLED will also have to be set to 'false' for this to work | ||
if [ "$APP_ENV" = "dev" ]; then | ||
echo "APP_ENV is set to 'dev'. Running flyway clean..." | ||
flyway clean | ||
else | ||
echo "APP_ENV is not 'dev'. Skipping flyway clean." | ||
fi | ||
|
||
# Execute the passed arguments (default to Flyway commands) | ||
exec flyway "$@" |