-
Notifications
You must be signed in to change notification settings - Fork 0
/
blueprint.yaml
74 lines (73 loc) · 2.44 KB
/
blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
components:
- name: RailsApp
type: service
image: ruby:3.2.2-slim
port: 3000
build:
steps:
- directory: /rails
- run: apt-get update
- run: apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3 postgresql-client
- run: curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/
- run: /tmp/node-build-master/bin/node-build 20.10.0 /usr/local/node
- run: /usr/local/node/bin/npm install -g yarn@1.22.19
- run: rm -rf /tmp/node-build-master
- copy: [Gemfile, Gemfile.lock]
destination: ./
- run: bundle install
- run: rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
- run: bundle exec bootsnap precompile --gemfile
- copy: [package.json, yarn.lock]
destination: ./
- run: yarn install --frozen-lockfile
- copy: .
destination: ./
- run: bundle exec bootsnap precompile app/ lib/
- run: SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
runtime:
entrypoint: "/rails/bin/docker-entrypoint"
command: "./bin/rails server -b 0.0.0.0"
resources:
- PgDatabase
- RecordCache
variables:
DATABASE_URL:
$resources: PgDatabase.url
REDIS_URL:
$resources: RecordCache.url
SERVER_ADDR: "noop-rails.local.noop.app"
- name: Migrate
type: task
image: ruby:3.2.2-slim
build:
steps:
- directory: /rails
- run: apt-get update
- run: apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3 postgresql-client
- copy: [Gemfile, Gemfile.lock]
destination: ./
- run: bundle install
- run: rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
- run: bundle exec bootsnap precompile --gemfile
- copy: .
destination: ./
runtime:
command: "./bin/rails db:migrate"
resources:
- PgDatabase
variables:
DATABASE_URL:
$resources: PgDatabase.url
lifecycles:
- event: BeforeServices
components:
- Migrate
routes:
- target:
component: RailsApp
resources:
- name: PgDatabase
type: postgresql
- name: RecordCache
type: redis