Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
}
},
"initializeCommand": "docker pull gvenzl/oracle-free:latest",
"initializeCommand": "bash .devcontainer/initializeCommand.sh",
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
"remoteEnv": {
"DATABASE_NAME": "FREEPDB1",
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached
- ./tzdata:/opt/tzdata:ro
command: sleep infinity
network_mode: service:oracle

Expand Down
19 changes: 19 additions & 0 deletions .devcontainer/initializeCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -euo pipefail

IMAGE=gvenzl/oracle-free:latest
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
OUT_DIR="$SCRIPT_DIR/tzdata"

docker pull "$IMAGE"

mkdir -p "$OUT_DIR"
rm -f "$OUT_DIR"/timezlrg_*.dat "$OUT_DIR"/timezdif_*.dat

docker run --rm --entrypoint sh \
-v "$OUT_DIR:/out" \
"$IMAGE" \
-c 'cp "$ORACLE_HOME"/oracore/zoneinfo/timezlrg_*.dat /out/ && chmod a+r /out/*.dat'

ls -1 "$OUT_DIR"
12 changes: 12 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ set -e
gem update --system
bundle install

# Match Instant Client TZ data to the Oracle server's to avoid ORA-01805.
# The file is extracted from the gvenzl image into .devcontainer/tzdata/ by
# initializeCommand.sh and bind-mounted read-only at /opt/tzdata.
TZ_FILE=$(ls /opt/tzdata/timezlrg_*.dat 2>/dev/null | head -1)
if [ -n "$TZ_FILE" ]; then
echo "Using $TZ_FILE for Instant Client TZ data."
export ORA_TZFILE="$TZ_FILE"
echo "export ORA_TZFILE=$TZ_FILE" | sudo tee /etc/profile.d/ora-tzfile.sh > /dev/null
else
echo "Warning: no timezlrg_*.dat found under /opt/tzdata; skipping ORA_TZFILE setup." >&2
fi

echo "Waiting for Oracle to be ready..."
oracle_ready=false
for i in $(seq 1 30); do
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Gemfile.lock
*.zip
.idea
spec/support/custom_config.rb
.devcontainer/tzdata/