Skip to content
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

Update Dockerfile #402

Merged
merged 155 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
562e458
This fixes the problem with limit when it is not a number
antolinos May 19, 2022
a87b2e6
Added test
antolinos May 19, 2022
d601ba7
feat: support skip/limit string parameters on search-api
antolinos May 24, 2022
8c3dde1
feat: support skip/limit string parameters on search-api and added te…
antolinos May 24, 2022
eb74970
feat: support skip and limit string parameters on search-api
antolinos May 24, 2022
db94b37
feat: support skip and limit string parameters on search-api
antolinos May 24, 2022
ab3839a
test: check for a different exception for invalid values
MRichards99 May 24, 2022
076e805
Merge pull request #364 from antolinos/issue_363
MRichards99 May 25, 2022
cfa1996
5.1.0
actions-user May 25, 2022
11a0eeb
fix: update to latest dependencies
Reillyhewitson Sep 22, 2022
75646db
Minimise dependencies changed
Reillyhewitson Sep 22, 2022
71625f8
Merge pull request #382 from ral-facilities/dependency/dparse
Reillyhewitson Sep 22, 2022
8eb3ea4
5.1.1
actions-user Sep 22, 2022
02c3e41
feat: Add support for yaml configuration
Reillyhewitson Sep 12, 2022
be34683
create example yaml config
Reillyhewitson Sep 12, 2022
2ae0a20
add yaml configurations to gitignore
Reillyhewitson Sep 12, 2022
46723de
feat: Enable support for yaml configuration files for DatagatewayAPI
Reillyhewitson Sep 12, 2022
432b940
Update github actions and readme
Reillyhewitson Sep 13, 2022
7f26f2d
Debug github actions
Reillyhewitson Sep 14, 2022
94dc710
Change log file creation in actions to use yq instead of jq
Reillyhewitson Sep 14, 2022
5d09b14
Fix linter and safety
Reillyhewitson Sep 15, 2022
1d3059b
use poetry 1.1 for github actions
Reillyhewitson Sep 15, 2022
b60b39e
Correct example config
Reillyhewitson Sep 15, 2022
cff0177
generate swagger to false
Reillyhewitson Sep 22, 2022
68d4267
docs: Update the poetry installation documentation
Reillyhewitson Sep 8, 2022
1d43086
make changes from review
Reillyhewitson Sep 15, 2022
73f3c77
feat: Changes to tests so they pass with icat 5
Reillyhewitson Sep 22, 2022
023e7c7
use icat5 ansible
Reillyhewitson Sep 22, 2022
d8825fd
feat: Add warning that tests only work with ICAT 5
Reillyhewitson Sep 22, 2022
bc47a65
update poetry lock file
Reillyhewitson Oct 5, 2022
2be2282
Test user credentials to yaml
Reillyhewitson Oct 11, 2022
a9e5816
safety fix
Reillyhewitson Oct 13, 2022
8ee7f27
use / as api url
Reillyhewitson Oct 13, 2022
5495195
Address requested changes
Reillyhewitson Oct 31, 2022
f59ca0f
Fix linting
Reillyhewitson Nov 1, 2022
ab160a8
Update for dparse
Reillyhewitson Nov 1, 2022
4d6b066
pin flake8-black to 0.2.4
Reillyhewitson Nov 1, 2022
dc14f9f
feat: Add new entity endpoints for icat5
Reillyhewitson Oct 5, 2022
c4b850f
docs: Updated postman collection with new entities
Reillyhewitson Oct 5, 2022
30b8907
Fix linting
Reillyhewitson Oct 5, 2022
8e69dd9
change nulls and backrefs
Reillyhewitson Oct 26, 2022
0e75fef
Change dates backref as causing KeyErrors
Reillyhewitson Oct 26, 2022
b7fdbe0
generate openapi and fix model references
Reillyhewitson Oct 31, 2022
63c2faa
Test all models and fix issues
Reillyhewitson Nov 1, 2022
6f10cb3
address linter issues
Reillyhewitson Nov 1, 2022
9bb898d
Merge pull request #381 from ral-facilities/feature/icat5-tests#374
Reillyhewitson Nov 3, 2022
2c64b7d
Merge pull request #378 from ral-facilities/docs/new-poetry-installer…
Reillyhewitson Nov 3, 2022
40197b2
5.2.0
invalid-email-address Nov 3, 2022
dd18e18
feat: Add new entity endpoints for icat5
Reillyhewitson Oct 5, 2022
4dd4895
docs: Updated postman collection with new entities
Reillyhewitson Oct 5, 2022
49f31b3
Fix linting
Reillyhewitson Oct 5, 2022
0ce5727
change nulls and backrefs
Reillyhewitson Oct 26, 2022
99fb986
Change dates backref as causing KeyErrors
Reillyhewitson Oct 26, 2022
92f8682
generate openapi and fix model references
Reillyhewitson Oct 31, 2022
df446d6
Test all models and fix issues
Reillyhewitson Nov 1, 2022
c434218
address linter issues
Reillyhewitson Nov 1, 2022
5dc78c3
Add test for updating data
Reillyhewitson Oct 12, 2022
451e618
Add tests for multiple updates
Reillyhewitson Oct 12, 2022
9cc8757
Implement more tests
Reillyhewitson Oct 13, 2022
b31d037
test_create_data encountering datetime error
Reillyhewitson Oct 13, 2022
0e7fc3d
test_update_vallid encounters a datetime faillure
Reillyhewitson Oct 13, 2022
6972dcc
Fix sessions and linting
Reillyhewitson Oct 13, 2022
3a5a4a3
Add tests for where filter
Reillyhewitson Nov 1, 2022
55574cb
Fix tests for icat5
Reillyhewitson Nov 2, 2022
b311637
Revert changes to invalid update with id
Reillyhewitson Nov 3, 2022
652d1db
figure out strange behaviour, make tests more useful
Reillyhewitson Nov 3, 2022
196dadc
Fix log location
Reillyhewitson Nov 7, 2022
a38dc89
Change test_user_credentials
Reillyhewitson Nov 7, 2022
7246e4b
No dg api extension
Reillyhewitson Nov 9, 2022
7854093
Make user_credentials a dict
Reillyhewitson Nov 9, 2022
fe1271a
Fix example log location
Reillyhewitson Nov 10, 2022
c18b669
Set example to be configured for datagateway tests
Reillyhewitson Nov 10, 2022
3c91635
feat: Add warning for no api
Reillyhewitson Nov 10, 2022
7dee9f6
Fix linting
Reillyhewitson Nov 10, 2022
a24d429
Remove print statement
Reillyhewitson Nov 14, 2022
e3e2005
Add login test
Reillyhewitson Nov 14, 2022
962dd80
Merge pull request #386 from ral-facilities/feature/no-api-warning#380
Reillyhewitson Nov 16, 2022
57edaaa
5.3.0
invalid-email-address Nov 16, 2022
2eb6e11
Add explanation for why test might fail
Reillyhewitson Nov 16, 2022
8921643
Merge branch 'main' into feature/use-yaml-config#372
Reillyhewitson Nov 16, 2022
3e59c86
Add exstension change
Reillyhewitson Nov 16, 2022
819e7a1
fix: do not attempt to create related entities if not included #387
VKTB Nov 16, 2022
fcbfb0f
test: fix failing tests #387
VKTB Nov 16, 2022
f224aca
fix generator script
Reillyhewitson Nov 16, 2022
1e08ed9
Ignore vulnerability and change generator workflow
Reillyhewitson Nov 16, 2022
6549b3e
linting and safety
Reillyhewitson Nov 16, 2022
c8567ef
Requested changes
Reillyhewitson Nov 21, 2022
5a63e70
Generator script workflow changes
Reillyhewitson Nov 21, 2022
0b6151b
ci: Main branch uses yaml config not json
Reillyhewitson Nov 21, 2022
9cfa727
Requested changes from review
Reillyhewitson Nov 22, 2022
185e304
Initial reorganisation
Reillyhewitson Nov 16, 2022
aa39a81
Fix linting
Reillyhewitson Nov 16, 2022
7ffc4b8
reorganise new DB tests
Reillyhewitson Nov 22, 2022
5060d5e
Merge pull request #388 from ral-facilities/feature/use-yaml-config#372
Reillyhewitson Nov 22, 2022
9c0f527
6.0.0
invalid-email-address Nov 22, 2022
849a4aa
Merge pull request #391 from ral-facilities/fix/icat-generator-workflow
Reillyhewitson Nov 22, 2022
3943ec4
Merge pull request #383 from ral-facilities/feature/icat5-endpoints#373
Reillyhewitson Nov 23, 2022
d7a5a16
6.1.0
invalid-email-address Nov 23, 2022
1e6c600
Merge pull request #390 from ral-facilities/bugfix/related-entities-c…
VKTB Nov 23, 2022
22141b5
6.1.1
invalid-email-address Nov 23, 2022
b9831bd
Merge branch 'main' into tests/db-backend-tests-#370
Reillyhewitson Nov 23, 2022
41c1586
Merge pull request #385 from ral-facilities/tests/db-backend-tests-#370
Reillyhewitson Nov 23, 2022
71d81ac
6.2.0
invalid-email-address Nov 23, 2022
0dc5a03
Initial refactor
Reillyhewitson Dec 1, 2022
4ebeb77
Add panosc mapping to unit tests
Reillyhewitson Dec 1, 2022
d2c697a
Working generator
Reillyhewitson Dec 2, 2022
23ee841
Optimisation and cleanup of unused code
Reillyhewitson Dec 2, 2022
c0595ba
Split unit and integration test runs
Reillyhewitson Dec 12, 2022
ebcb7a6
Checkout api earlier
Reillyhewitson Dec 12, 2022
4e275f6
Create config earlier and dependency updates
Reillyhewitson Dec 12, 2022
da66fac
Ignore sqlalchemy vulnerability
Reillyhewitson Dec 13, 2022
b3d0fc5
Use latest codecov action
Reillyhewitson Dec 13, 2022
a6f5d06
Multiple codecov uploads
Reillyhewitson Dec 13, 2022
f89fe2a
refresh id for long generators
Reillyhewitson Dec 15, 2022
ebd60b6
update to v1
Reillyhewitson Dec 15, 2022
86b9a11
assert correct values for v1
Reillyhewitson Dec 15, 2022
3d9954d
Multithread large generators
Reillyhewitson Dec 15, 2022
e7b8794
remove get_icat_entity_name_as_camel_case
Reillyhewitson Dec 15, 2022
25e9c29
Fix datafileparamter range
Reillyhewitson Dec 15, 2022
24c3bd7
Fix linting
Reillyhewitson Jan 3, 2023
9940720
Fix datafile parameter generator
Reillyhewitson Jan 3, 2023
a0e9527
Update python icat to full release
Reillyhewitson Jan 4, 2023
aa4350c
Update readme for new test runners.
Reillyhewitson Jan 4, 2023
3f5e6be
Less data generation
Reillyhewitson Jan 4, 2023
71f3b8b
Cut number of datacollections
Reillyhewitson Jan 5, 2023
a0349ba
Clean up
Reillyhewitson Jan 5, 2023
985aa02
Remove poetry install and setuptools install
Reillyhewitson Jan 10, 2023
f9eb154
Readd fix for python 3.10
Reillyhewitson Jan 10, 2023
5f11ba2
Poetry install needed for generator
Reillyhewitson Jan 10, 2023
c2e3f77
Remove second checkout
Reillyhewitson Jan 10, 2023
35780bb
Add prep for api for integration tests
Reillyhewitson Jan 10, 2023
a4fa2e7
Remove multiprocessing
Reillyhewitson Jan 10, 2023
fe6b137
Merge branch 'tests/reorganise-tests#375' into tests/python_icatv1
Reillyhewitson Feb 1, 2023
8627dbb
Merge pull request #396 from ral-facilities/tests/python_icatv1
Reillyhewitson Feb 1, 2023
21b0233
Changes to filters, endpoints and queries
Reillyhewitson Feb 1, 2023
619d3e4
Update for safety
Reillyhewitson Feb 1, 2023
b08022a
Merge pull request #393 from ral-facilities/tests/reorganise-tests#375
Reillyhewitson Feb 6, 2023
1ef9eb2
FIx dg-api tests
Reillyhewitson Feb 10, 2023
d28919e
Fix search-api tests and linting
Reillyhewitson Feb 10, 2023
9616219
Merge branch 'main' into feature/icat-backend-generator#369
Reillyhewitson Feb 10, 2023
b060ffe
Fix lock file
Reillyhewitson Feb 10, 2023
cf7d8a2
Add function to remove creationDate from responses
Reillyhewitson Feb 13, 2023
9e4da17
Consistency test drop mod/createTime
Reillyhewitson Feb 13, 2023
f14bccb
move and rename sql script, fix path
Reillyhewitson Feb 13, 2023
ae6ae0b
feat: Refactor icat generator to use python-icat
Reillyhewitson Feb 13, 2023
31aad3e
Merge pull request #401 from ral-facilities/feature/icat-backend-gene…
Reillyhewitson Feb 17, 2023
4b121d6
6.3.0
invalid-email-address Feb 17, 2023
ee00790
Merge branch 'main' into k8s-deployment
ajkyffin Feb 20, 2023
92cffd9
Update Dockerfile and add entrypoint script
ajkyffin Feb 20, 2023
dfb54ba
Use specific python and alpine versions in the base image
ajkyffin Feb 21, 2023
f03d853
Pin python package versions in Dockerfile
ajkyffin Feb 21, 2023
14073b3
Use a cache mount to speed up pip and poetry
ajkyffin Feb 21, 2023
f701c9e
Comment the RUN step
ajkyffin Feb 21, 2023
6ad492c
Move things out of the datagateway-api-run directory
ajkyffin Feb 21, 2023
e7630dc
Remove workaround that is no longer needed
ajkyffin Feb 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 66 additions & 31 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,48 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Checkout DataGateway API
uses: actions/checkout@v2

# Install Nox, Poetry and API's dependencies
- name: Install Nox
run: pip install nox==2020.8.22
- name: Install Poetry
run: pip install poetry==1.1.9

# This command is a workaround for getting Poetry working with Python 3.10. An
# fix is made in Poetry 1.2.0a2 but there is currently no official release for
# Poetry 1.2 and am apprehensive to moving to a pre-release. Disabling the
# experimental installer is a workaround for Poetry 1.1.x
# See https://github.com/python-poetry/poetry/issues/4210 for more details
- name: Disable Poetry's experimental new installer
if: ${{ matrix.python-version == '3.10' }}
run: poetry config experimental.new-installer false

# Prep for using the API for tests
- name: Create log file
run: touch logs.log
- name: Configure log file location
run: echo "`yq \
'.log_location="${GITHUB_WORKSPACE}/logs.log"' datagateway_api/config.yaml.example | envsubst`" > datagateway_api/config.yaml.example
- name: Configure datagateway extension
run: echo "`yq \
'.datagateway_api.extension="/datagateway_api"' datagateway_api/config.yaml.example`" > datagateway_api/config.yaml.example
- name: Create config.yaml
run: cp datagateway_api/config.yaml.example datagateway_api/config.yaml
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# Run Unit tests
- name: Run Nox unit tests session
run: nox -p ${{ matrix.python-version }} -s unit_tests -- --cov=datagateway_api --cov-report=xml
- name: Upload unit test code coverage report
if: matrix.python-version == '3.6'
uses: codecov/codecov-action@v3

# ICAT Ansible clone and install dependencies
- name: Checkout icat-ansible
if: success()
uses: actions/checkout@v2
with:
repository: icatproject-contrib/icat-ansible
Expand Down Expand Up @@ -85,46 +125,35 @@ jobs:
- name: Create log file
run: touch logs.log
- name: Configure log file location
run: echo "`jq -r --arg REPO_DIR "$GITHUB_WORKSPACE/logs.log" \
'.log_location=$REPO_DIR' datagateway_api/config.json.example`" > datagateway_api/config.json.example
- name: Create config.json
run: cp datagateway_api/config.json.example datagateway_api/config.json
run: echo "`yq \
'.log_location="${GITHUB_WORKSPACE}/logs.log"' datagateway_api/config.yaml.example | envsubst`" > datagateway_api/config.yaml.example
- name: Configure datagateway extension
run: echo "`yq \
'.datagateway_api.extension="/datagateway_api"' datagateway_api/config.yaml.example`" > datagateway_api/config.yaml.example
- name: Create config.yaml
run: cp datagateway_api/config.yaml.example datagateway_api/config.yaml
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# Install Nox, Poetry and API's dependencies
- name: Install Nox
run: pip install nox==2020.8.22
- name: Install Poetry
run: pip install poetry==1.1.9

# Installing an older version of setuptools for reasons explained at: https://github.com/icatproject/python-icat/issues/99
- name: Uninstall setuptools
run: poetry run pip uninstall -y setuptools
- name: Install older setuptools
run: poetry run pip install 'setuptools<58.0.0'

# This command is a workaround for getting Poetry working with Python 3.10. An
# fix is made in Poetry 1.2.0a2 but there is currently no official release for
# Poetry 1.2 and am apprehensive to moving to a pre-release. Disabling the
# experimental installer is a workaround for Poetry 1.1.x
# See https://github.com/python-poetry/poetry/issues/4210 for more details
- name: Disable Poetry's experimental new installer
run: poetry config experimental.new-installer false

- name: Install dependencies
run: poetry install

- name: Add dummy data to icatdb
run: |
poetry run python -m util.icat_db_generator

# Run Nox tests session, saves and uploads a coverage report to codecov
- name: Run Nox tests session
run: nox -p ${{ matrix.python-version }} -s tests -- --cov=datagateway_api --cov-report=xml
- name: Upload code coverage report
# Run Nox integration tests session, saves and uploads a coverage report to codecov
- name: Run Nox Integration tests session
if: success()
run: nox -p ${{ matrix.python-version }} -s integration_tests -- --cov=datagateway_api --cov-report=xml
- name: Upload integration test code coverage report
if: matrix.python-version == '3.6'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

linting:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -246,10 +275,10 @@ jobs:
- name: Checkout DataGateway API
uses: actions/checkout@v2

- name: Create config.json
run: cp datagateway_api/config.json.example datagateway_api/config.json
- name: Create config.yaml
run: cd /home/runner/work/datagateway-api/datagateway-api; cp datagateway_api/config.yaml.example datagateway_api/config.yaml
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json
run: cd /home/runner/work/datagateway-api/datagateway-api; cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json
- name: Install Poetry
run: pip install poetry==1.1.9

Expand All @@ -264,7 +293,9 @@ jobs:

- name: Add dummy data to icatdb
run: poetry run python -m util.icat_db_generator
- name: Get SQL dump of dummy data
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of dummy data to be prepared
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_1.sql

# Drop and re-create icatdb to remove generated data
Expand All @@ -279,6 +310,8 @@ jobs:
- name: Add (new) dummy data to icatdb
run: |
cd /home/runner/work/datagateway-api/datagateway-api; poetry run python -m util.icat_db_generator
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of new dummy data
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_2.sql

Expand All @@ -300,10 +333,10 @@ jobs:
with:
ref: ${{ github.event.repository.default_branch }}

- name: Create config.json
run: cp datagateway_api/config.json.example datagateway_api/config.json
- name: Create config.yaml
run: cd /home/runner/work/datagateway-api/datagateway-api; cp datagateway_api/config.yaml.example datagateway_api/config.yaml
- name: Create search_api_mapping.json
run: cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json
run: cd /home/runner/work/datagateway-api/datagateway-api; cp datagateway_api/search_api_mapping.json.example datagateway_api/search_api_mapping.json

# Installing an older version of setuptools for reasons explained at: https://github.com/icatproject/python-icat/issues/99
- name: Uninstall setuptools
Expand All @@ -316,6 +349,8 @@ jobs:

- name: Add dummy data to icatdb
run: poetry run python -m util.icat_db_generator
- name: Drop modTime and createTime
run: mysql -picatdbuserpw -uicatdbuser icatdb < /home/runner/work/datagateway-api/datagateway-api/util/columns_to_drop.sql
- name: Get SQL dump of dummy data from main's generator script
run: mysqldump -picatdbuserpw -uicatdbuser --skip-comments icatdb > ~/generator_script_dump_main.sql

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ venv/
*.pyc
logs.log*
config.json*
config.yaml
search_api_mapping.json*
.vscode/
.nox/
Expand Down
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,59 @@

<!--next-version-placeholder-->

## v6.3.0 (2023-02-17)
### Feature
* Refactor icat generator to use python-icat ([`ae6ae0b`](https://github.com/ral-facilities/datagateway-api/commit/ae6ae0b2a2ce375fb0d47851b3091c952735f5c6))

## v6.2.0 (2022-11-23)
### Feature
* Add new entity endpoints for icat5 ([`dd18e18`](https://github.com/ral-facilities/datagateway-api/commit/dd18e18bc19f87c5aa7c99c144f262b68e4fe0c6))

### Documentation
* Updated postman collection with new entities ([`4dd4895`](https://github.com/ral-facilities/datagateway-api/commit/4dd489574245f4f6020c490d5cddeb3fc3c65c91))

## v6.1.1 (2022-11-23)
### Fix
* Do not attempt to create related entities if not included #387 ([`819e7a1`](https://github.com/ral-facilities/datagateway-api/commit/819e7a1582d8d108fe5f18b210c08d67cd0a3845))

## v6.1.0 (2022-11-23)
### Feature
* Add new entity endpoints for icat5 ([`dc14f9f`](https://github.com/ral-facilities/datagateway-api/commit/dc14f9f8aeb5a9849bc69cf647bf068b04a63d81))

### Documentation
* Updated postman collection with new entities ([`c4b850f`](https://github.com/ral-facilities/datagateway-api/commit/c4b850f913dbded35e6b1a88c8f8d8e1b36cbdec))

## v6.0.0 (2022-11-22)
### Feature
* Enable support for yaml configuration files for DatagatewayAPI ([`46723de`](https://github.com/ral-facilities/datagateway-api/commit/46723de2bf5336244b3dd37808f565e554b5cbdb))
* Add support for yaml configuration ([`02c3e41`](https://github.com/ral-facilities/datagateway-api/commit/02c3e41c92c721d793b27b44c7b27cfb3af6ffbb))

### Breaking
* Remove support for json configuration files ([`46723de`](https://github.com/ral-facilities/datagateway-api/commit/46723de2bf5336244b3dd37808f565e554b5cbdb))

## v5.3.0 (2022-11-16)
### Feature
* Add warning for no api ([`3c91635`](https://github.com/ral-facilities/datagateway-api/commit/3c91635bc0c3465d456a4a85c8d6c8793df408c2))

## v5.2.0 (2022-11-03)
### Feature
* Add warning that tests only work with ICAT 5 ([`d8825fd`](https://github.com/ral-facilities/datagateway-api/commit/d8825fd71740e2b2d9b387dca175110cee1f9915))
* Changes to tests so they pass with icat 5 ([`73f3c77`](https://github.com/ral-facilities/datagateway-api/commit/73f3c777f8d3841cf09537140922a9bbdd8dad7c))

### Documentation
* Update the poetry installation documentation ([`68d4267`](https://github.com/ral-facilities/datagateway-api/commit/68d426722862613358b0b136188d2b61accdc56f))

## v5.1.1 (2022-09-22)
### Fix
* Update to latest dependencies ([`11a0eeb`](https://github.com/ral-facilities/datagateway-api/commit/11a0eeb3cbc4b5db2a0fa8dcd825dbeceb6ac111))

## v5.1.0 (2022-05-25)
### Feature
* Support skip and limit string parameters on search-api ([`db94b37`](https://github.com/ral-facilities/datagateway-api/commit/db94b375438873969db2d05621d9860a304ca8bd))
* Support skip and limit string parameters on search-api ([`eb74970`](https://github.com/ral-facilities/datagateway-api/commit/eb74970c1a74c6e0bed62460dab5ba5881ba1df7))
* Support skip/limit string parameters on search-api and added testing ([`8c3dde1`](https://github.com/ral-facilities/datagateway-api/commit/8c3dde11deb7614dfd22e6433c24727eeff2f800))
* Support skip/limit string parameters on search-api ([`d601ba7`](https://github.com/ral-facilities/datagateway-api/commit/d601ba7e9b48186e624db4891c503484f8895b2a))

## v5.0.1 (2022-05-16)
### Fix
* Fix internal server error when running DG API on its own #359 ([`b0d3e06`](https://github.com/ral-facilities/datagateway-api/commit/b0d3e064dc842143de7f7f0a31b947122fae9f88))
Expand Down
51 changes: 40 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
# Dockerfile to build and serve datagateway-api

FROM python:3.6-slim-bullseye
VKTB marked this conversation as resolved.
Show resolved Hide resolved
# Build stage
FROM python:3.11-alpine3.17 as builder

WORKDIR /datagateway-api
WORKDIR /datagateway-api-build

COPY poetry.lock pyproject.toml ./
COPY . .
VKTB marked this conversation as resolved.
Show resolved Hide resolved

RUN python -m pip install --upgrade pip \
&& pip install 'poetry==1.1.13' \
&& poetry run pip uninstall -y setuptools \
&& poetry run pip install 'setuptools<58.0.0' \
&& poetry run pip install 'gunicorn==20.1.0' \
&& poetry install --no-dev
RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install 'poetry~=1.3.2' \
&& poetry build

COPY datagateway_api ./datagateway_api

# Install & run stage
FROM python:3.11-alpine3.17

WORKDIR /datagateway-api-run

COPY --from=builder /datagateway-api-build/dist/datagateway_api-*.whl /tmp

RUN --mount=type=cache,target=/root/.cache \
python3 -m pip install \
'gunicorn~=20.1.0' \
/tmp/datagateway_api-*.whl \
&& DATAGATEWAY_API_LOCATION="$(python3 -m pip show datagateway_api | awk '/^Location:/ { print $2 }')" \
# Create search_api_mapping.json from its .example file
&& cp "$DATAGATEWAY_API_LOCATION/datagateway_api/search_api_mapping.json.example" "$DATAGATEWAY_API_LOCATION/datagateway_api/search_api_mapping.json" \
# Create config.yaml from its .example file. It will need to be editted by the entrypoint script so create it in our non-root user's home directory and create a symlink
&& cp "$DATAGATEWAY_API_LOCATION/datagateway_api/config.yaml.example" "/datagateway-api-run/config.yaml" \
&& ln -s "/datagateway-api-run/config.yaml" "$DATAGATEWAY_API_LOCATION/datagateway_api/config.yaml" \
VKTB marked this conversation as resolved.
Show resolved Hide resolved
# Create a non-root user to run as
&& addgroup -S datagateway-api \
&& adduser -S -D -G datagateway-api -H -h /datagateway-api-run datagateway-api \
&& chown -R datagateway-api:datagateway-api /datagateway-api-run

USER datagateway-api

ENV ICAT_URL="http://localhost"
ENV ICAT_CHECK_CERT="true"
ENV LOG_LOCATION="/dev/stdout"
VKTB marked this conversation as resolved.
Show resolved Hide resolved

COPY docker/docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

# Serve the application using gunicorn - production ready WSGI server
ENTRYPOINT ["poetry", "run", "gunicorn", "-c", "gunicorn.conf.py", "datagateway_api.wsgi:application"]
CMD ["gunicorn", "-b", "0.0.0.0:8000", "datagateway_api.wsgi"]
EXPOSE 8000
Loading