Skip to content

Instantly share code, notes, and snippets.

@mikesparr
Created May 18, 2025 19:24
Show Gist options
  • Save mikesparr/354768c3d86a448d63b94770543eb91d to your computer and use it in GitHub Desktop.
Save mikesparr/354768c3d86a448d63b94770543eb91d to your computer and use it in GitHub Desktop.
Inline Dockerfile entrypoint.sh creation
# Create a script to load environment variables from mounted secrets
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
echo 'if [ -d "/secrets" ] && [ -f "/secrets/.env" ]; then' >> /app/entrypoint.sh && \
echo ' cp /secrets/.env /app/.env' >> /app/entrypoint.sh && \
echo ' echo "Loaded environment from mounted secret"' >> /app/entrypoint.sh && \
echo 'fi' >> /app/entrypoint.sh && \
echo 'exec node src/server.js' >> /app/entrypoint.sh && \
chmod +x /app/entrypoint.sh && \
chown nodeapp:nodeapp /app/entrypoint.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment