mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat(docker): one-line installer and release Compose file
Add scripts/install.sh, a one-line installer that checks Docker and Compose v2, installs into ~/opencode-manager (override with OCM_DIR), prompts for an optional OpenCode config import, a repos folder mount and LAN sign-in, then pulls and starts the published image. - Add docker-compose.release.yml, which runs the published image under the Compose project name ocm; a checkout's docker-compose.yml keeps building from source - Generate AUTH_SECRET on first container start and persist it to the data volume when unset, so Compose installs need no .env - Refuse to install over a source checkout or beside an existing install, so volumes and the auth secret are not silently replaced - Test the installer, entrypoint secret handling, and the two Compose files staying in step
This commit is contained in:
1 parent
87636bf1ff
commit
27996ed12d
10 files changed
+734
-31
No files matched your search
@@ -239,6 +239,32 @@ describe('workspace ownership configuration', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('compose image source', () => {
|
||||
const RELEASE_IMAGE_LINE = ' image: ghcr.io/chriswritescode-dev/opencode-manager:latest\n'
|
||||
const BUILD_BLOCK_RE = /^ {4}build:\n(?: {6}.*\n)+/m
|
||||
const withoutComments = (source: string) => source.replace(/^#.*\n/gm, '').replace(/^\n+/, '')
|
||||
|
||||
it('builds docker-compose.yml from the checkout so git pull and rebuild keep working', () => {
|
||||
const compose = read(composePath)
|
||||
expect(compose).toMatch(/^ {4}build:\n {6}context: \.\n {6}dockerfile: Dockerfile\n/m)
|
||||
expect(compose).not.toMatch(/^ {4}image:/m)
|
||||
})
|
||||
|
||||
it('keeps docker-compose.release.yml identical to docker-compose.yml apart from its project name and pulling the published image', () => {
|
||||
const compose = read(composePath)
|
||||
const release = withoutComments(read(join(repoRoot, 'docker-compose.release.yml')))
|
||||
const workflow = read(join(repoRoot, '.github/workflows/docker-build.yml'))
|
||||
expect(workflow).toContain('images: ghcr.io/${{ github.repository }}')
|
||||
expect(release).not.toMatch(/^ {4}build:/m)
|
||||
expect(release).toBe(`name: ocm\n\n${compose.replace(BUILD_BLOCK_RE, RELEASE_IMAGE_LINE)}`)
|
||||
})
|
||||
|
||||
it('lets the entrypoint generate AUTH_SECRET when .env does not set one', () => {
|
||||
expect(read(composePath)).toContain('- AUTH_SECRET=${AUTH_SECRET:-}')
|
||||
expect(read(envExamplePath)).not.toMatch(/^AUTH_SECRET=/m)
|
||||
})
|
||||
})
|
||||
|
||||
describe('docker lifecycle scripts', () => {
|
||||
it('keeps docker:down non-destructive and docker:reset destructive', () => {
|
||||
const pkg = read(join(repoRoot, 'package.json'))
|
||||
|
||||
Reference in new issue
Block a user