File size: 493 Bytes
2c55b64
 
8fd5ce8
 
2c55b64
8fd5ce8
 
e72f185
8fd5ce8
 
e72f185
8fd5ce8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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'))"]