【发布时间】:2021-04-02 21:21:28
【问题描述】:
我正在使用 Github Actions Service Container 来启动一个 postgres 实例,如下所示:
name: Pull Request
on:
pull_request:
branches:
- main
- staging
jobs:
test-and-build:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
...
这可行,但我想通过禁用 fsync 来加速 postgres 实例,如下所述:https://dev.to/thejessleigh/speed-up-your-postgresql-unit-tests-with-one-weird-trick-364p
当在 docker 容器中本地运行 postgres 时,这会大大加快我的运行速度,我希望在 Github Actions 中做同样的事情,但我正在努力了解如何配置图像。似乎将-c fsync=off 传递到上面的选项块会导致错误:
Exit code 125 returned from process: file name '/usr/bin/docker', arguments 'create --name 04a7236d2e964fccb8a7d95684b3cf05_postgres_0249b3 --label cc4956 --network github_network_3023184aafab424896b4e553d7ad9c38 --network-alias postgres -p 5432:5432 --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 -c fsync=off -e "POSTGRES_PASSWORD=postgres" -e GITHUB_ACTIONS=true -e CI=true postgres'.
有什么想法吗?
【问题讨论】:
标签: postgresql docker github continuous-integration github-actions