# Use ARG for build-time values, ENV for runtime values FROM alpine:latest # ARG: Build-time argument, only available during the build process. # Can be set with --build-arg during `docker build`. ARG BUILD_VERSION=1.0.0 ARG BUILD_DATE="$(date +%Y-%m-%d)" LABEL version=$BUILD_VERSION \ build_date=$BUILD_DATE \ maintainer="Your Name " # ENV: Runtime environment variable, available in the running container. # Can be overridden with -e during `docker run`. ENV APP_PORT=8080 \ APP_ENV=production WORKDIR /app # Example: A command demonstrating usage of ENV variables # Note: ARG values are NOT available at runtime in the container. RUN echo "Building version: $BUILD_VERSION, Build date: $BUILD_DATE" CMD echo "Application will run on port: $APP_PORT in $APP_ENV environment." && sleep infinity