mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
add docker-entrypoint file to support docker secrets
This commit is contained in:
1 parent
b97041e948
commit
28f4af8c13
2 files changed
+32
No files matched your search
@@ -18,6 +18,7 @@ WORKDIR /usr/src/app
|
||||
COPY package*.json ./
|
||||
RUN npm clean-install && npm cache clean --force
|
||||
COPY . .
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
FROM base as dev
|
||||
EXPOSE 8082
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
|
||||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
local val="$def"
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
val="$(< "${!fileVar}")"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
# load secrets either from environment variables or files
|
||||
file_env 'POSTGRES_PASSWORD'
|
||||
file_env 'SUPABASE_ANON_KEY'
|
||||
file_env 'SUPABASE_SERVICE_KEY'
|
||||
|
||||
exec "${@}"
|
||||
Reference in new issue
Block a user