-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Containerize application and configure GitHub Actions to build and push Docker image to Harbor #426
Conversation
…age-to-harbor-#355 Create Actions job for uploading container image to Harbor
…ile-#354 Create Dockerfile
Update Dockerfile
Conflicts: .github/dependabot.yml
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #426 +/- ##
==========================================
- Coverage 96.80% 94.78% -2.02%
==========================================
Files 40 40
Lines 3375 3375
Branches 317 317
==========================================
- Hits 3267 3199 -68
- Misses 80 135 +55
- Partials 28 41 +13 ☔ View full report in Codecov by Sentry. |
Your CI failures look similar to what we've seen on OG API. Have a look at the PR I made to fix the issues: ral-facilities/operationsgateway-api#59. The Semantic PR job seems to be working so that's good |
Thanks @MRichards99. From the PR that you linked, it looks like upgrading Poetry to 1.3.2 fixes this issue. However, I just had a look at Poetry's release notes and noticed that they dropped Python 3.6 support in their 1.2.0 version (see more here) and this project still supports 3.6. |
Ah yes, that's true. Having to support Python 3.6 is becoming a bit of an issue, there's so many dependencies that need upgrading but we can't as future versions drop 3.6 support (as you've experienced with Poetry). The root of this issue seems to be relating to a dependency called cachecontrol, read psf/cachecontrol#292 You could try pinning There's a brief discussion where someone is tied to a Poetry version < 1.2 at python-poetry/poetry#7877. I don't fully understand what's being discussed here and how we'd translate that into our repo but could be worth a try if you can work out what to do. We really need to move to support 3.8+ on this repo, but we can't until we can get 3.8 on a RIG VM/Docker for production 😢 |
Thank you @MRichards99. I think I somehow fixed the failures in #427. I agree, though, that we need to drop support for the older Python 3 versions. |
Description
This PR adds a Dockerfile which can be used to build a Docker image and create a container using it. It is configured to create a production image and run a Gunicorn server on port
8000
when a container is started.To add an extra layer of security, the image has been set up so that containers run as non-root.
Environment variables have also been defined in the Dockerfile to allow for values to be passed at runtime to future running containers. These values are then used by the
docker-entrypoint.sh
script, which acts as an entry point script that is executed when the container starts, to update the config values in theconfig.yaml
file. The environment variables are:ICAT_URL
(Default value:http://localhost
)ICAT_CHECK_CERT
(Default value:false
)LOG_LOCATION
(Default value:/dev/stdout
)Finally, this PR adds a
docker
job to theci-build
GitHub Actions workflow to build a Docker image using the Dockerfile introduced in this PR and push the same to Harbor. The job only triggers if all the other jobs succeed and does different things depending on the context. It builds the Docker image in all cases and also pushes the image to Harbor only if something is pushed to themain
branch.To build an image, run the command below in the
datagateway-api
repo directoryTo start a container on port
8000
from the image that you just built, run:If you want to pass values for the environment variables then instead run:
Testing Instructions
Add a set up instructions describing how the reviewer should test the code
icatdb Generator Script Consistency Test
CI job fails, is this because of a deliberate change made to the script to change generated data (which isn't actually a problem) or is here an underlying issue with the changes made?fix:
,feat:
orBREAKING CHANGE:
so a release is automatically made via GitHub Actions upon merge?