# ![Docker](https://hackmd.io/_uploads/rJKu_Gyvgl.png) --- Why Docker? --- ![15216168472596](https://hackmd.io/_uploads/rylE2MkPgx.png =100%x) --- ![programmerhumor-io-programming-memes-2fda9abcc7dc92e](https://hackmd.io/_uploads/H1oH0MkPge.jpg) --- \: can we docker? \: we have docker at home --- docker at home: ![image](https://hackmd.io/_uploads/ByU-Jmkvex.png) --- ### *Setup* 1. Get [Docker for Mac](https://store.docker.com/editions/community/docker-ce-desktop-mac) ```bash brew cask install docker open -a Docker.app ``` 2. Clone Cyberbiz ```bash git clone git@github.com:sinlead/cyberbiz.co.git cd cyberbiz.cp ``` 3. Install [docker-sync](https://github.com/EugenMayer/docker-sync): ```bash gem install docker-sync ``` 4. Invoke the setup script ```bash ./setup.sh ``` --- ## `./setup.sh` --- ![ζˆͺεœ– 2025-07-24 上午11.03.30](https://hackmd.io/_uploads/B1AhQXkvxg.png =80%x) :thinking_face: --- GitHub permissions babyyyyyyy ![image](https://hackmd.io/_uploads/rJc3J4yDgx.png) --- - `volumes: ~/.ssh:/root/.ssh` - `volumes: /var/root/.ssh:/root/.ssh` - `docker build . --build-arg SSH_PRIVATE_KEY="$(sudo cat /var/root/.ssh/id_rsa)"` - secrets in docker-compose.yml --- `ssh: Could not resolve hostname github.com-repo-hct-express: nodename nor servname provided, or not known` --- ![image](https://hackmd.io/_uploads/BkLszBkwxl.png) - remove `CI=true` ? --- Yiyang ![image](https://hackmd.io/_uploads/B1N2QBkwle.png) --- `bundle install` --- `ERROR: CMake is required to build Rugged.` --- ![image](https://hackmd.io/_uploads/SJX3BS1Plx.png) --- wkhtmltox `Invalid platform` --- ![image](https://hackmd.io/_uploads/HkYJvSyPxg.png) --- ![image](https://hackmd.io/_uploads/HJQCPrkDxe.png) --- zbar `Unable to find zbar shared library` --- ```yaml - ZBAR_LIB=/usr/lib/aarch64-linux-gnu/libzbar.so.0 ``` --- `variable sql_mode can't be set to the value of no_auto_create_user in MySQL 8.0` --- ![image](https://hackmd.io/_uploads/B1S31Ikwge.png) --- rake assets:precompile` requires mysql connection - run mysql server first, or - `config.assets.initialize_on_precompile = false` --- RAILS 5+ ``` ActiveRecord::ProtectedEnvironmentError: You are attemptingto run a destructive action against your 'production' database. If you are sure you want to continue, run the same command with the environment variable: DISABLE_DATABASE_ENVIRONMENT_CHECK=1 ``` ```bash db:drop DISABLE_DATABASE_ENVIRONMENT_CHECK=1 ``` --- some not-really-docker problem ![1753338250635](https://hackmd.io/_uploads/SyP3b8JDgg.png) --- `cp config/app_secret_config.yml` --- db:migration `Unknown column 'order_line_items.deleted_at' in 'where clause'` ```ruby # In app/models/order_line_item.rb - add this temporarily def self.reset_column_information super # Remove any default scopes during migrations self.default_scopes = [] end ``` > Thanks to Alen Dong (TWD), Amazon Q --- ``` /bin/sh: -c: line 0: unexpected EOF while looking for matching `"' /bin/sh: -c: line 1: syntax error: unexpected end of file ``` --- Gemfile.lock ![image](https://hackmd.io/_uploads/SyXJvIkvll.png) --- `Unknown version XX of op_mob` --- ```bash # frontend/shop/.browserlistrc: not op_mob >= 1 ``` --- ![1520193279881](https://hackmd.io/_uploads/rka_YLkwgg.jpg) --- `docker-sync-stack start` --- ![image](https://hackmd.io/_uploads/HkdCK8yPlx.png) --- `exited with code 137` --- ![image](https://hackmd.io/_uploads/H1_L58Jwgl.png) --- ASSET_FROM_REMOTE ![image](https://hackmd.io/_uploads/SkJRq8yvgg.png) but it's all or one --- ```bash ASSET_FROM_REMOTE=shop bundle exec puma ASSET_FROM_REMOTE=shop,checkout,pos bundle exec puma ASSET_FROM_REMOTE=except:shop bundle exec puma ASSET_FROM_REMOTE=except:shop,pos bundle exec puma # also fixed some code # - app/services/frontend/manifest.rb # - app/concerns/shops/shop_app_path.rb ``` --- COMPOSE_PROFILES ![image](https://hackmd.io/_uploads/Bymu28yveg.png) ```yaml ASSET_FROM_REMOTE: except:${COMPOSE_PROFILES:-} ``` ```bash COMPOSE_PROFILES=shop docker-sync-stack start COMPOSE_PROFILES=shop,pos docker-sync-stack start docker-sync-stack start ``` --- ![image](https://hackmd.io/_uploads/BJrn2UJwgx.png) --- rspec/cucumber `cannot connect to mysql database / frontend server` --- Add dev/test envs - `config/app_config.yml` - `config/database.yml.docker` - `features/support/env.rb` - allow `cdn.cybassets.com` --- Are we there yet? --- Time for a test build on a potato laptop --- ![image](https://hackmd.io/_uploads/r1Z5CIJPgl.png) `yarn build exited with code 137` --- we have remote assets anyways --- Features --- .env ```ini ARCH=arm64 # $(uname -m) ARM64=true # set to empty if not ARM64 WKHTMLTOX_ARCH=arm64 # one of amd64, arm64, i386, ppc64el SSH_PRIVATE_KEY_PATH=/Users/your.name/.ssh/id_rsa # your github ssh private key path SSH_CONFIG_PATH=/Users/your.name/.ssh/config # your github ssh config path REPLICA_USERNAME=your.name # your database replica username REPLICA_PASSWORD=yourpassword # your database replica password # path to zbar library, you probably need it for ARM64 ZBAR_LIB=/usr/lib/aarch64-linux-gnu/libzbar.so.0 ``` docker compose reads this. --- - runs a rails shell `docker-compose run --rm rails bash` - runs a replica rails shell `docker-compose run --rm replica bash` --- Thanks!
{"title":"Docker","description":"Why docker?","contributors":"[{\"id\":\"316444af-23e0-4ddb-bfd1-69bb074068c7\",\"add\":7815,\"del\":2469,\"latestUpdatedAt\":1753344899789}]"}
    110 views