Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automate migrations#41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kkartunov merged 2 commits intodevelopfromauto-migrations
Nov 11, 2025
Merged

Automate migrations#41

kkartunov merged 2 commits intodevelopfromauto-migrations
Nov 11, 2025

Conversation

@kkartunov
Copy link
Contributor

Running migrations automatically when service starts.


RUN mkdir -p /challenge-api/reports

RUN echo"Running database migrations..."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[⚠️performance]
Combining theecho command with thenpx prisma migrate deploy command into a singleRUN statement can reduce the number of layers in the Docker image, which can improve build performance and reduce image size. Consider usingRUN echo "Running database migrations..." && npx prisma migrate deploy.

RUN mkdir -p /challenge-api/reports

RUN echo"Running database migrations..."
RUN npx prisma migrate deploy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[❗❗correctness]
Running database migrations automatically when the container starts can lead to potential issues if multiple instances of the container are started simultaneously, as they might attempt to run migrations concurrently. Consider implementing a locking mechanism or ensuring that only one instance handles migrations to avoid race conditions.

kkartunov reacted with thumbs up emojikkartunov reacted with eyes emoji

CMD ["node","/challenge-api/app.js"]
# Copy entrypoint script and make it executable
COPY docker/entrypoint.sh /entrypoint.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[❗❗correctness]
Ensure that theentrypoint.sh script handles errors gracefully, especially during migrations. This is crucial to prevent the container from entering a crash loop if migrations fail.


# Start the application
echo"Starting application server..."
exec node /challenge-api/app.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[💡design]
Usingexec to start the application server is a good practice as it replaces the shell with the node process, ensuring that the process receives signals directly. Ensure that this behavior is intended.

@kkartunovkkartunov merged commitb829e34 intodevelopNov 11, 2025
6 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@jmgasperjmgasperAwaiting requested review from jmgasper

@vas3avas3aAwaiting requested review from vas3a

@hentrymartinhentrymartinAwaiting requested review from hentrymartin

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@kkartunov

[8]ページ先頭

©2009-2025 Movatter.jp