Skip to content

Commit 6093983

Browse files
authored
Docker: use docker compose (v2) (#194)
The old version was removed in 9932d8a, but we never updated the commands to use the new version. The docker compose plugin is already included when installing docker from the official site. See https://docs.docker.com/compose/install/.
1 parent b002742 commit 6093983

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dockerfiles/tasks.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
DOCKER_COMPOSE_WEBPACK = 'common/dockerfiles/docker-compose-webpack.yml'
99
DOCKER_COMPOSE_ASSETS = 'dockerfiles/docker-compose-assets.yml'
1010
DOCKER_COMPOSE_OVERRIDE = 'docker-compose.override.yml'
11-
DOCKER_COMPOSE_COMMAND = f'docker-compose --project-directory=. -f {DOCKER_COMPOSE} -f {DOCKER_COMPOSE_OVERRIDE} -f {DOCKER_COMPOSE_SEARCH} -f {DOCKER_COMPOSE_WEBPACK}'
11+
DOCKER_COMPOSE_COMMAND = f'docker compose --project-directory=. -f {DOCKER_COMPOSE} -f {DOCKER_COMPOSE_OVERRIDE} -f {DOCKER_COMPOSE_SEARCH} -f {DOCKER_COMPOSE_WEBPACK}'
1212

1313
@task(help={
1414
'cache': 'Build Docker image using cache (default: False)',
@@ -19,10 +19,10 @@ def build(c, cache=False):
1919
c.run(f'{DOCKER_COMPOSE_COMMAND} build {cache_opt}', pty=True)
2020

2121
@task(help={
22-
'command': 'Command to pass directly to "docker-compose"',
22+
'command': 'Command to pass directly to "docker compose"',
2323
})
2424
def compose(c, command):
25-
"""Pass the command to docker-compose directly."""
25+
"""Pass the command to docker compose directly."""
2626
c.run(f'{DOCKER_COMPOSE_COMMAND} {command}', pty=True)
2727

2828
@task(help={
@@ -56,7 +56,7 @@ def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False,
5656
cmd.append('DOCKER_NO_RELOAD=t' if not reload else 'DOCKER_NO_RELOAD=')
5757
cmd.append(f'RTD_LOGGING_LEVEL={log_level}')
5858

59-
cmd.append('docker-compose')
59+
cmd.append('docker compose')
6060
cmd.append('--project-directory=.')
6161
cmd.append(f'-f {DOCKER_COMPOSE}')
6262
cmd.append(f'-f {DOCKER_COMPOSE_OVERRIDE}')
@@ -165,7 +165,7 @@ def test(c, arguments='', running=True):
165165
@task
166166
def buildassets(c):
167167
"""Build all assets for the application and push them to backend storage"""
168-
c.run(f'docker-compose -f {DOCKER_COMPOSE_ASSETS} run --rm assets bash -c "npm ci && node_modules/bower/bin/bower --allow-root update && npm run build"', pty=True)
168+
c.run(f'docker compose -f {DOCKER_COMPOSE_ASSETS} run --rm assets bash -c "npm ci && node_modules/bower/bin/bower --allow-root update && npm run build"', pty=True)
169169
c.run(f'{DOCKER_COMPOSE_COMMAND} run --rm web python3 manage.py collectstatic --noinput', pty=True)
170170

171171

0 commit comments

Comments
 (0)