I added the ability to load secret config variables (HUB_TOKEN, STRIPE_SECRET_KEY etc) from files, to support Docker Secrets natively. The code should probably log an error if a specified HUB_TOKEN_FILE doesn'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 the Dockerfile, 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.
Adds:
- a Docker image, which can be used in both development and production
- a `docker-compose.yml` file for local development (could probably be adapted for production deployments)
Testing:
- `git checkout docker`
- `docker-compose up`
- pray 🙏
- go to http://localhost:5000
## App architecture
I added the ability to load secret config variables (`HUB_TOKEN`, `STRIPE_SECRET_KEY` etc) from files, to support [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) natively. The code should probably log an error if a specified `HUB_TOKEN_FILE` doesn'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 the `Dockerfile`, 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.
Fantastic 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.
Fantastic 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.
Off-topic: does capsul do tagged releases? That'd be handy as the plugins/docker plugin has a auto_tag: true which generates the image tag based on the git tag. That is probably One For Later ™️
Off-topic: does capsul do tagged releases? That'd be handy as the [plugins/docker](http://plugins.drone.io/drone-plugins/drone-docker/) plugin has a `auto_tag: true` which generates the image tag based on the git tag. That is probably One For Later :tm:
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: true work off the branch name? I'd love a way to be able to publish different images from different branches without hardcoding the branch name.
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: true` work off the branch name? I'd love a way to be able to publish different images from different branches without hardcoding the branch name.
Feel free to ignore but I usually add --no-cache to 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.
Feel free to ignore but I usually add `--no-cache` to 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.
```
RUN apk add --no-cache \
build-base \
gcc \
gettext \
git \
jpeg-dev \
libffi-dev \
libjpeg \
musl-dev \
postgresql-dev \
python3-dev \
zlib-dev \
--virtual .build-dependencies
```
This 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.
This 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.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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