diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b845dee..1bf4290 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,8 @@ "features": { "ghcr.io/rails/devcontainer/features/ruby:2": { "version": "4.0.3" - } + }, + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} }, "customizations": { "vscode": { diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 22c8c4b..039f2c5 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -22,4 +22,21 @@ fi ci/setup_accounts.sh +# Force client TZ data to match server (ORA_TZFILE workaround). +# Mirrors the CI workaround added in rsim/ruby-plsql#292: gvenzl/oracle-free +# ships a newer timezone-data version than the "latest" Instant Client embeds, +# so ruby-oci8 raises ORA-01805 for DATE/TIMESTAMP fetches unless the client +# uses the server's timezlrg_*.dat. The Docker CLI and socket are provided by +# the docker-outside-of-docker devcontainer feature. +ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-free" -q) +SRC=$(docker exec "$ORACLE_CONTAINER" bash -c 'ls $ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat 2>/dev/null | head -1') +echo "Server TZ file: $SRC" +DST_DIR="$ORACLE_HOME/oracore/zoneinfo" +sudo mkdir -p "$DST_DIR" +docker cp "$ORACLE_CONTAINER":"$SRC" /tmp/_server_tzfile.dat +sudo mv /tmp/_server_tzfile.dat "$DST_DIR/$(basename "$SRC")" +ls -l "$DST_DIR" +echo "export ORA_TZFILE=$DST_DIR/$(basename "$SRC")" | sudo tee /etc/profile.d/ora_tzfile.sh > /dev/null +sudo chmod +x /etc/profile.d/ora_tzfile.sh + echo "Dev container setup complete. You are ready to start developing ruby-plsql!"