Docker image, & local development docker-compose.yml #2
Reference in New Issue
Block a user
No description provided.
Delete Branch "docker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds:
docker-compose.ymlfile for local development (could probably be adapted for production deployments)Testing:
git checkout dockerdocker-compose upApp architecture
I added the ability to load secret config variables (
HUB_TOKEN,STRIPE_SECRET_KEYetc) from files, to support Docker Secrets natively. The code should probably log an error if a specifiedHUB_TOKEN_FILEdoesn't exist instead of failing silently..Docker architecture
This uses a multi-stage build to reduce the size of the final image -- having pipenv install to a predefined virtualenv, and then copying that over.
The compose file doesn't include a definition for a cron runner service, and I haven't tested running one yet. Here be dragons!
You can rebuild the image locally using
docker-compose build, but this isn't required for changes to the app code, only if you edit theDockerfile, or want to publish your image for use on a swarm server (in which case you will need to edit the image name to put in your own Docker hub credentials).Currently, the image is rebuild (should set up auto-tagging..) and publish with every push to this 3wordchant/capsul-flask fork.
6102e812a0tobe6c1b38b7Fantastic work! All of my comments are mostly rambly commentary on not-necessary changes at all unless you feel like it. I had a glass of wine and I was enjoying typing. You'll have to forgive me.
@ -0,0 +10,4 @@password:from_secret: docker_reg_passwd_3wcrepo: 3wordchant/capsul-flasktags: latestOff-topic: does capsul do tagged releases? That'd be handy as the plugins/docker plugin has a
auto_tag: truewhich generates the image tag based on the git tag. That is probably One For Later ™️The last one was a year ago, I think, probably worth asking Cyberia if they'd be down for that?
Even more off-topic: can
auto_tag: truework off the branch name? I'd love a way to be able to publish different images from different branches without hardcoding the branch name.auto_tagdoesn't, but I think it's possible with interpolating e.g.${DRONE_COMMIT_BRANCH}, see982556a@ -0,0 +1,33 @@FROM python:3.8-alpine as buildRUN apk add gettext git gcc python3-dev musl-dev \Feel free to ignore but I usually add
--no-cacheto save space and newline + sort things so it is easier to have a visual overview of dependencies and alphabetic ordering to know where to slot things in. Can be useful if you end up adding a lot of dependencies and then need to remove them over time as the software changes.@ -0,0 +17,4 @@FROM python:3.8-alpineRUN apk add --no-cache libpq libstdc++ libjpeg virt-install libvirt-client \Same totally optional comment as https://git.autonomic.zone/3wordchant/capsul-flask/pulls/2/files#issuecomment-7607.
@ -31,0 +33,4 @@"SPOKE_HOST_TOKEN", "HUB_TOKEN", "STRIPE_SECRET_KEY","BTCPAY_PRIVATE_KEY", "MAIL_PASSWORD"]:var = os.environ.get(f"{var_name}_FILE", False)Optional:
var = os.environ.get(f"{var_name}_FILE")also works as it defaults toNoneif missing.@ -0,0 +26,4 @@devices:- "/dev/kvm:/dev/kvm"db:image: "postgres:9.6.5"Maybe
postgres:9.6-alpineas it is smaller? https://hub.docker.com/_/postgres?tab=description&page=1&ordering=last_updatedThis seems fine to me. One thing I would like to mention, I have been agitating about trying to set up a private docker image / open container image repository for cyberia for a while. Ideally in the future we could do that and use the cyberia concourse build system to build the images, but that doesnt need to block this PR.
OK, wonderful. I'm very happy to help migrate to the Cyberia registry when it exists, and a Concourse build when I find time to wrap my head around secret management.
8e22948f82to13646e64dalatest