Skip to content

Arifinahmad99 cloud patch 1#284

Open
arifinahmad99-cloud wants to merge 4 commits intoptmt:masterfrom
arifinahmad99-cloud:arifinahmad99-cloud-patch-1
Open

Arifinahmad99 cloud patch 1#284
arifinahmad99-cloud wants to merge 4 commits intoptmt:masterfrom
arifinahmad99-cloud:arifinahmad99-cloud-patch-1

Conversation

@arifinahmad99-cloud
Copy link

🔍 What This Achieves

· Full control over the database image: you can modify the postgres/Dockerfile to add extensions, change config, or use a different base.
· Persistent database data via Docker volume.
· App and database run in separate containers but are networked together.
· Environment variables like DATABASE_URL are available in your app container.


🛠️ Customizing Further

· MySQL/MongoDB: Replace the db service with mysql or mongo and adjust the Dockerfile accordingly.
· Initialization scripts: Add .sql or .sh files to /docker-entrypoint-initdb.d/ (PostgreSQL/MySQL) to create schemas or seed data automatically.
· Database configuration: Mount custom my.cnf (MySQL) or postgresql.conf (PostgreSQL) into the container.

This setup gives you maximum flexibility while keeping your development environment isolated and reproducible.

Explanation of Key Parts

Section Purpose
image Uses a Microsoft-maintained Node.js 18 image (includes git, curl, etc.).
features Adds Java 17 (for Android builds), Docker-in-Docker (if you need to run Android emulators in containers – not typical), and Ruby (for CocoaPods).
postCreateCommand Runs a setup script (see below) after the container is created. This script installs React Native CLI, CocoaPods, Watchman, and Android SDK.
forwardPorts Exposes Metro bundler (8081) and Expo ports.
customizations Configures VS Code with essential extensions and settings for React Native.
remoteUser Runs as node user to avoid permission issues with mounted files.

Accompanying Script: .devcontainer/post-create.sh
Set up a Dockerfile for Node.js development environment with Java 17, React Native CLI, CocoaPods, and Watchman.
This script sets up the Android SDK by downloading command line tools, accepting licenses, and installing required SDK components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant