Skip to content

Commit

Permalink
Revert "Merge branch 'chore/docker-compose_to_docker_compose' into st…
Browse files Browse the repository at this point in the history
…aging"

This reverts commit d3d2dd8, reversing
changes made to 4e215d8.
  • Loading branch information
SharmaineLim committed Jan 8, 2025
1 parent 737015a commit 1c6f785
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20 AS frontend
FROM node:20 as frontend

# Make build & post-install scripts behave as if we were in a CI environment (e.g. for logging verbosity purposes).
ARG CI=true
Expand Down Expand Up @@ -91,10 +91,10 @@ COPY ./docker/bashrc.sh /home/tbx/.bashrc

# Run the WSGI server. It reads GUNICORN_CMD_ARGS, PORT and WEB_CONCURRENCY
# environment variable hence we don't specify a lot options below.
CMD ["gunicorn", "tbx.wsgi:application"]
CMD gunicorn tbx.wsgi:application

# These steps won't be run on production
FROM production AS dev
FROM production as dev

# Swap user, so the following tasks can be run as root
USER root
Expand All @@ -117,4 +117,4 @@ RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh
COPY --chown=tbx --from=frontend ./node_modules ./node_modules

# do nothing forever - exec commands elsewhere
CMD ["tail", "-f", "/dev/null"]
CMD tail -f /dev/null
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: '3.7'
services:
web:
build:
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# A custom compose file for $FRONTEND=docker, which also binds frontend ports

version: '3.7' # NB synchronise with /docker-compose.yml
services:
web:
ports:
Expand Down
29 changes: 12 additions & 17 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


def dexec(cmd, service="web"):
return local(f"docker compose exec -T {quote(service)} bash -c {quote(cmd)}")
return local(f"docker-compose exec -T {quote(service)} bash -c {quote(cmd)}")


@task
Expand All @@ -52,8 +52,8 @@ def build(c):
local(f"chown -R $USER:{group} {directories_arg}")
local("chmod -R 775 " + directories_arg)

local("docker compose pull", pty=True)
local("docker compose build", pty=True)
local("docker-compose pull")
local("docker-compose build")


@task
Expand All @@ -62,11 +62,10 @@ def start(c):
Start the development environment
"""
if FRONTEND == "local":
local("docker compose up --detach", pty=True)
local("docker-compose up -d")
else:
local(
"docker compose -f docker-compose.yml -f docker/docker-compose-frontend.yml up -d",
pty=True,
"docker-compose -f docker-compose.yml -f docker/docker-compose-frontend.yml up -d"
)


Expand All @@ -75,7 +74,7 @@ def stop(c):
"""
Stop the development environment
"""
local("docker compose stop", pty=True)
local("docker-compose stop")


@task
Expand All @@ -92,23 +91,23 @@ def destroy(c):
"""
Destroy development environment containers (database will lost!)
"""
local("docker compose down --volumes", pty=True)
local("docker-compose down")


@task
def sh(c, service="web"):
"""
Run bash in a local container
"""
subprocess.run(["docker", "compose", "exec", service, "bash"])
subprocess.run(["docker-compose", "exec", service, "bash"])


@task
def sh_root(c, service="web"):
"""
Run bash as root in the local web container.
"""
subprocess.run(["docker", "compose", "exec", "--user=root", "web", "bash"])
subprocess.run(["docker-compose", "exec", "--user=root", "web", "bash"])


@task
Expand All @@ -117,8 +116,7 @@ def psql(c, command=None):
Connect to the local postgres DB using psql
"""
cmd_list = [
"docker",
"compose",
"docker-compose",
"exec",
"db",
"psql",
Expand Down Expand Up @@ -454,8 +452,7 @@ def run_test(c):
"""
subprocess.call(
[
"docker",
"compose",
"docker-compose",
"exec",
"web",
"python",
Expand All @@ -472,6 +469,4 @@ def migrate(c):
"""
Run database migrations
"""
subprocess.run(
["docker", "compose", "run", "--rm", "web", "./manage.py", "migrate"]
)
subprocess.run(["docker-compose", "run", "--rm", "web", "./manage.py", "migrate"])

0 comments on commit 1c6f785

Please sign in to comment.