Skip to content

Commit e7aee13

Browse files
yahondaclaude
andcommitted
Apply ORA_TZFILE workaround to devcontainer
#292 added the ORA-01805 workaround to the remaining `gvenzl/oracle-free` CI workflows. The same root cause -- the server image shipping a newer timezone-data version than the "latest" Instant Client embeds -- affects the dev container, which combines `gvenzl/oracle-free:latest` (Oracle service) with the Instant Client installed via the app `Dockerfile` and talks to it through ruby-oci8. Mirror the workflow step in `postCreateCommand.sh` immediately after `ci/setup_accounts.sh`: locate the running Oracle container, copy its `timezlrg_*.dat` onto the Instant Client's `oracore/zoneinfo`, and persist `ORA_TZFILE` via `/etc/profile.d/ora_tzfile.sh` so every login shell (and the rspec runs they launch) sees the override. The Docker CLI and the host docker socket needed to drive `docker exec` / `docker cp` are provided by the standard `ghcr.io/devcontainers/features/docker-outside-of-docker` feature, added alongside the existing Ruby feature in `devcontainer.json`. The lookup is dynamic, so a future gvenzl image bump continues to work without further edits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d57a0a5 commit e7aee13

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"features": {
77
"ghcr.io/rails/devcontainer/features/ruby:2": {
88
"version": "4.0.3"
9-
}
9+
},
10+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
1011
},
1112
"customizations": {
1213
"vscode": {

.devcontainer/postCreateCommand.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,21 @@ fi
2222

2323
ci/setup_accounts.sh
2424

25+
# Force client TZ data to match server (ORA_TZFILE workaround).
26+
# Mirrors the CI workaround added in rsim/ruby-plsql#292: gvenzl/oracle-free
27+
# ships a newer timezone-data version than the "latest" Instant Client embeds,
28+
# so ruby-oci8 raises ORA-01805 for DATE/TIMESTAMP fetches unless the client
29+
# uses the server's timezlrg_*.dat. The Docker CLI and socket are provided by
30+
# the docker-outside-of-docker devcontainer feature.
31+
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-free" -q)
32+
SRC=$(docker exec "$ORACLE_CONTAINER" bash -c 'ls $ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat 2>/dev/null | head -1')
33+
echo "Server TZ file: $SRC"
34+
DST_DIR="$ORACLE_HOME/oracore/zoneinfo"
35+
sudo mkdir -p "$DST_DIR"
36+
docker cp "$ORACLE_CONTAINER":"$SRC" /tmp/_server_tzfile.dat
37+
sudo mv /tmp/_server_tzfile.dat "$DST_DIR/$(basename "$SRC")"
38+
ls -l "$DST_DIR"
39+
echo "export ORA_TZFILE=$DST_DIR/$(basename "$SRC")" | sudo tee /etc/profile.d/ora_tzfile.sh > /dev/null
40+
sudo chmod +x /etc/profile.d/ora_tzfile.sh
41+
2542
echo "Dev container setup complete. You are ready to start developing ruby-plsql!"

0 commit comments

Comments
 (0)