1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-27 11:26:22 -07:00

Publish ports and detach from container by default

This commit is contained in:
Eggbertx 2021-03-01 20:23:53 -08:00
parent f9756bf55e
commit 6bd77b7c34
4 changed files with 17 additions and 5 deletions

View file

@ -174,7 +174,7 @@ def dependencies():
for dep in gc_dependencies:
run_cmd("go get -v " + dep, realtime = True, print_command = True)
def docker(option = "guestdb"):
def docker(option = "guestdb", attached = False):
cmd = "docker-compose -f {} up --build"
if option == "guestdb":
cmd = cmd.format("docker/docker-compose-mariadb.yaml")
@ -182,6 +182,8 @@ def docker(option = "guestdb"):
cmd = cmd.format("docker/docker-compose.yml.default")
elif option == "macos":
cmd = cmd.format("docker/docker-compose-syncForMac.yaml")
if not attached:
cmd += " --detach"
status = run_cmd(cmd, print_output = True, realtime = True, print_command = True)[1]
if status != 0:
print("Failed starting a docker container, exited with status code", status)
@ -305,8 +307,15 @@ if __name__ == "__main__":
default = "guestdb", choices = ["guestdb", "hostdb", "macos"],
help = "create a Docker container, see docker/README.md for more info"
)
parser.add_argument("--attached",
action = "store_true",
help = "keep the command line attached to the container (by default it runs detached)"
)
args = parser.parse_args()
docker(args.option)
try:
docker(args.option, args.attached)
except KeyboardInterrupt:
print("Received keyboard interrupt, exiting")
elif action == "install":
parser.add_argument("--prefix",
default = "/usr",

View file

@ -5,7 +5,8 @@ services:
context: ..
dockerfile: docker/Dockerfile
ports:
- "80"
- "80:80"
- "443:443"
volumes:
- ../:/opt/gochan # note: this doesn't work too well in MacOS.
environment:

View file

@ -6,7 +6,8 @@ services:
context: ..
dockerfile: docker/Dockerfile
ports:
- "80"
- "80:80"
- "443:443"
environment:
- DBTYPE=mysql # change this to 'postgresql' if needed
- DATABASE_HOST=host.docker.internal

View file

@ -5,7 +5,8 @@ services:
context: ..
dockerfile: docker/Dockerfile
ports:
- "80"
- "80:80"
- "443:443"
volumes:
- ../:/opt/gochan # note: this doesn't work too well in MacOS.
environment: