-
Notifications
You must be signed in to change notification settings - Fork 158
/
docker-compose.registry.yaml
137 lines (129 loc) · 5.36 KB
/
docker-compose.registry.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'
#
# Docker compose for exposed test networks
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'
services:
# ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
#
# Provides a local NPM registry
#
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
npm-registry:
image: verdaccio/verdaccio
ports:
- "4873:4873"
healthcheck:
interval: 2s
retries: 10
test:
[
"CMD",
"wget",
"--output-document",
"--tries=1",
"--no-verbose",
"--spider",
"http://0.0.0.0:4873/-/ping",
]
stop_grace_period: 120s
volumes:
- ./verdaccio.yaml:/verdaccio/conf/config.yaml
# ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
#
# Publishes all packages to the local repository
#
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
publish:
extends:
file: docker-compose.templates.yaml
service: project
depends_on:
- npm-registry
# Here we build and publish all the packages locally,
# including any pending changesets.
#
# Even though we enabled anonymous publishing in verdaccio,
# we need to specify some sort of an auth token
# since we are trying to publish scoped packages. This can be anything,
# any non-empty string will do
command:
- /bin/bash
- -c
- |
# First we configure the registry and provide a fake mock token
pnpm config set registry http://npm-registry:4873/
pnpm config set //npm-registry:4873/:_authToken MOCK_TOKEN
# Then we build the packages (we don't need to build the tests or examples)
pnpm build --filter='./packages/*'
# Now we publish the packages
#
# FIXME This will publish the packages under their current versions, not taking any changesets into account.
# Taking changesets into account comes with a convoluted issue:
#
# Once changesets are applied, package.json files are updated. These changes are not propagated to the repository
# from which the examples are being cloned though. So even though the packages will be updated & published,
# examples contained in the repository will hold references to their old versions
#
# The solution is to serve these changes out of a local git repository - very much possible
# with one blocker - tiged, an NPM package we use to clone the examples, can only work with github repositories
# and does not support e.g. local git repositories as sources
pnpm release:publish
# Now we apply changesets and publish the new versions
#
# This step can remain after the above step has been removed and the cloning logic updated
pnpm release:version
pnpm release:publish
volumes:
# We'll need to provide the changeset files for this step
- ./.changeset:/app/.changeset
# ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
#
# Runs user tests
#
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
tests:
build:
target: user
args:
BASE_IMAGE: ${DEVTOOLS_BASE_IMAGE:-base}
depends_on:
publish:
condition: service_completed_successfully
# create-lz-oapp allows us to specify the repository/ref we pull the examples from
#
# In order to test the version on this branch in github actions,
# we'll set these based on the default variables github gives us
#
# If these are not provided, for example if running on a local machine,
# we'll default them to our repository and empty ref
environment:
- LAYERZERO_EXAMPLES_REPOSITORY_URL=${LAYERZERO_EXAMPLES_REPOSITORY_URL}
- LAYERZERO_EXAMPLES_REPOSITORY_REF=${LAYERZERO_EXAMPLES_REPOSITORY_REF}
working_dir: /app
command:
- /bin/bash
- -c
- |
# First we configure the registry
pnpm config set registry http://npm-registry:4873/
# Then we provide some debug information
#
# Not the double $$ that makes docker compose not interpolate these from environment variables
# present on the host machine - instead, we'll get the actual container environment values
echo "create-lz-oapp:repository $${LAYERZERO_EXAMPLES_REPOSITORY_URL}"
echo "create-lz-oapp:ref $${LAYERZERO_EXAMPLES_REPOSITORY_REF}"
# Now we run the user tests
/app/tests-user/lib/bats-core/bin/bats --verbose-run --recursive ./tests-user/tests
volumes:
# If we want to clone from github.com, we'll need its public keys added to our SSH config
# otherwise git clone would trigger an interactive prompt asking us to add a server fingerprint
#
# See more here https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
- ./tests-user/ssh/known_hosts:/root/.ssh/known_hosts
# The testing library and test suites
- ./tests-user:/app/tests-user