Skip to content

Conversation

@gschaer
Copy link

@gschaer gschaer commented Feb 14, 2025

Summary

This PR addresses three issues:

  1. Undefined PROJECT_NAME Variable:
    The Dockerfile referenced ${PROJECT_NAME} in the default value of USER_CODE_PATH without declaring it as a build argument, which caused a warning during the build process.

  2. Deprecated Compose File Version:
    Removed the version: '3' key from docker-compose.yml since specifying the version is deprecated in current Docker Compose files.

  3. Restart Policy Update:
    Changed the container restart policy from on-failure:5 to unless-stopped. This update ensures that the container will restart unless explicitly stopped, which can provide more predictable behavior in various runtime environments.

Changes Made

  • Dockerfile:

    • Declared ARG PROJECT_NAME before using it in the default value for USER_CODE_PATH.
  • docker-compose.yml:

    • Removed the version: '3' line.
    • Added the build argument for PROJECT_NAME so its value is passed during the build.
    • Updated the restart policy to unless-stopped.

Testing

  • Ran docker compose up --force-recreate --build -d to verify that:
    • The undefined variable warning is resolved.
    • The container builds and runs as expected.
  • Confirmed that removing version: '3' does not affect the compose functionality.
  • Verified that the container now adheres to the new restart policy.

Impact

These changes ensure that:

  • The Docker build process handles the PROJECT_NAME variable correctly.
  • The docker-compose configuration is up-to-date with current best practices.
  • The container restart behavior is improved with the unless-stopped policy.

…n, and update restart policy

- Declare ARG PROJECT_NAME in the Dockerfile to resolve an undefined variable warning.
- Remove deprecated 'version: "3"' from docker-compose.yml.
- Update the container restart policy from "on-failure:5" to "unless-stopped" for more robust behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant