wizard fixup (#55)

* Retool dockerfile to stick to 3.7 & add maintainer, change wizard to not default always to "app", run when .env exists (like it does in the git tree)

* don't mix up microblog.pub v. micropub
This commit is contained in:
Jack Laxson 2019-06-17 16:55:39 -04:00 committed by Thomas Sileo
parent 42bf96e44a
commit f8d341f94a
3 changed files with 10 additions and 7 deletions

View file

@ -2,13 +2,13 @@ PYTHON=python
SETUP_WIZARD_IMAGE=microblogpub-setup-wizard:latest
PWD=$(shell pwd)
# Build the config (will error if an existing config is found) via a Docker container
# Build the config (will error if an existing config/me.yml is found) via a Docker container
.PHONY: config
config:
# Build the container for the setup wizard on-the-fly
cd setup_wizard && docker build . -t $(SETUP_WIZARD_IMAGE)
# Run and remove instantly
-docker run --rm -it --volume $(PWD):/app/out $(SETUP_WIZARD_IMAGE)
-docker run -e MICROBLOGPUB_WIZARD_PROJECT_NAME --rm -it --volume $(PWD):/app/out $(SETUP_WIZARD_IMAGE)
# Finally, remove the tagged image
docker rmi $(SETUP_WIZARD_IMAGE)

View file

@ -1,5 +1,7 @@
FROM python:3
FROM python:3.7
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
LABEL maintainer="t@a4.io"
LABEL pub.microblog.oneshot=true
CMD ["python", "wizard.py"]

View file

@ -15,12 +15,11 @@ def main() -> None:
config_file = Path("/app/out/config/me.yml")
env_file = Path("/app/out/.env")
if config_file.exists() or env_file.exists():
if config_file.exists():
# Spit out the relative path for the "config artifacts"
rconfig_file = "config/me.yml"
renv_file = ".env"
print(
f"Existing setup detected, please delete {rconfig_file} and/or {renv_file} before restarting the wizard"
f"Existing setup detected, please delete {rconfig_file} before restarting the wizard"
)
sys.exit(2)
@ -58,12 +57,14 @@ def main() -> None:
with config_file.open("w") as f:
f.write(out)
proj_name = os.getenv("MICROBLOGPUB_WIZARD_PROJECT_NAME", "microblogpub")
env = {
"WEB_PORT": 5005,
"CONFIG_DIR": "./config",
"DATA_DIR": "./data",
"POUSSETACHES_AUTH_KEY": binascii.hexlify(os.urandom(32)).decode(),
"COMPOSE_PROJECT_NAME": Path.cwd().name.replace(".", ""),
"COMPOSE_PROJECT_NAME": proj_name,
}
out2 = ""