Update Dockerfile
Browse files- Dockerfile +8 -9
Dockerfile
CHANGED
|
@@ -1,14 +1,13 @@
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
# Ensure the timestamp is available as an environment variable
|
| 10 |
-
# ENV BUILD_TIMESTAMP=$timestamp
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
# Print the timestamp to verify
|
| 14 |
-
RUN echo "The build timestamp is $timestamp"
|
|
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
| 3 |
+
# Generate the timestamp and store it in a file
|
| 4 |
+
RUN echo $(date +%s) > /timestamp.txt
|
| 5 |
|
| 6 |
+
# Set an environment variable to the timestamp value
|
| 7 |
+
ENV TIMESTAMP_FILE=/timestamp.txt
|
| 8 |
|
| 9 |
+
# Use a custom entrypoint or command to load the timestamp into an environment variable
|
| 10 |
+
ENTRYPOINT ["/bin/sh", "-c", "export TIMESTAMP=$(cat $TIMESTAMP_FILE) && exec \"$@\"", "--"]
|
| 11 |
|
| 12 |
+
# Example command to show how to use it
|
| 13 |
+
CMD ["python", "-c", "import os; print('Timestamp:', os.getenv('TIMESTAMP'))"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|