| FROM python:3.10 | |
| # Generate the timestamp and store it in a file | |
| RUN echo $(date +%s) > /timestamp.txt | |
| # Set an environment variable to the timestamp value | |
| ENV TIMESTAMP_FILE=/timestamp.txt | |
| # Use a custom entrypoint or command to load the timestamp into an environment variable | |
| ENTRYPOINT ["/bin/sh", "-c", "export TIMESTAMP=$(cat $TIMESTAMP_FILE) && exec \"$@\"", "--"] | |
| # Example command to show how to use it | |
| CMD ["python", "-c", "import os; print('Timestamp:', os.getenv('TIMESTAMP'))"] |