Skip to content

Commit

Permalink
Merge pull request #21 from hifis-net/20-reduce_image_size
Browse files Browse the repository at this point in the history
Reduce Docker image size
  • Loading branch information
cmeessen authored Oct 28, 2022
2 parents 6ab435e + 8fcb040 commit 5ace5f1
Show file tree
Hide file tree
Showing 7 changed files with 328 additions and 171 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: CC0-1.0

FROM python:3.9-bullseye
FROM python:3.9-slim-bullseye

ENV POSTGREST_URL "http://localhost/api/v1"
ENV PGRST_JWT_SECRET "123"
Expand All @@ -13,9 +13,9 @@ COPY . .

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wget libmagick-dev && \
rm -rf /var/lib/apt/lists/* && \
pip3 install poetry && \
poetry install && \
wget "https://raw.githubusercontent.com/eficode/wait-for/v2.2.3/wait-for" -O wait-for.sh && \
chmod +x wait-for.sh
poetry install

CMD [ "/opt/spotlight-migration/start.sh" ]
9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 changes: 25 additions & 27 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,45 +37,45 @@
ORGANISATIONS = {
"Helmholtz Centre for Environmental Research (UFZ)": {
"logo": "UFZ.svg",
"ror":"000h6jb29",
"ror": "000h6jb29",
},
"Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences": {
"Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences": {
"logo": "GFZ.svg",
"ror":"04z8jg394",
"ror": "04z8jg394",
},
"German Aerospace Center (DLR)": {
"German Aerospace Center (DLR)": {
"logo": "DLR.svg",
"ror":"04bwf3e34",
"ror": "04bwf3e34",
},
"Alfred Wegener Institute for Polar and Marine Research (AWI)": {
"Alfred Wegener Institute for Polar and Marine Research (AWI)": {
"logo": "AWI.svg",
"ror":"032e6b942",
"ror": "032e6b942",
},
"Karlsruhe Institute of Technology (KIT)": {
"Karlsruhe Institute of Technology (KIT)": {
"logo": "KIT.svg",
"ror":"04t3en479",
"ror": "04t3en479",
},
"CISPA Helmholtz Center for Information Security": {
"CISPA Helmholtz Center for Information Security": {
"logo": "CISPA.png",
"ror":"02njgxr09",
"ror": "02njgxr09",
},
"Helmholtz Centre for Heavy Ion Research (GSI)": {
"Helmholtz Centre for Heavy Ion Research (GSI)": {
"logo": "GSI.svg",
"ror":"02k8cbn47",
"ror": "02k8cbn47",
},
"Helmholtz Centre For Ocean Research Kiel (GEOMAR)": {
"Helmholtz Centre For Ocean Research Kiel (GEOMAR)": {
"logo": "GEOMAR.jpg",
"ror":"02h2x0161",
"ror": "02h2x0161",
},
"Helmholtz-Zentrum Dresden-Rossendorf": {
"Helmholtz-Zentrum Dresden-Rossendorf": {
"logo": "HZDR.png",
"ror":"01zy2cs03",
"ror": "01zy2cs03",
},
"Forschungszentrum Jülich": {
"Forschungszentrum Jülich": {
"logo": "FZJ.svg",
"ror":"02nv7yv05",
"ror": "02nv7yv05",
},
"Deutsches Elektronen-Synchrotron DESY": {
"Deutsches Elektronen-Synchrotron DESY": {
"logo": "DESY.svg",
"ror": "01js2sh04",
},
Expand Down Expand Up @@ -490,16 +490,12 @@ async def add_organisations(client, spotlight):

org_slug = org_name_to_slug(org)
ror_id = "https://ror.org/%s" % ORGANISATIONS.get(org).get("ror") or None
if ror_id is None or ror_id == "https://ror.org/" :
if ror_id is None or ror_id == "https://ror.org/":
logging.warn("Could not find ROR Id for: %s" % org)

res = (
await client.from_("organisation")
.insert({
"name": org,
"slug": org_slug,
"ror_id": ror_id
})
.insert({"name": org, "slug": org_slug, "ror_id": ror_id})
.execute()
)

Expand All @@ -508,7 +504,9 @@ async def add_organisations(client, spotlight):
org_id = await get_id_for_organisation(client, org)

logo_exists = await organisation_has_logo(client, org)
logo_available = org in ORGANISATIONS.keys() and "logo" in ORGANISATIONS.get(org).keys()
logo_available = (
org in ORGANISATIONS.keys() and "logo" in ORGANISATIONS.get(org).keys()
)
if not logo_exists and not logo_available:
logging.warn("No logo found for %s" % org)
MISSING_LOGOS.append(org)
Expand Down
11 changes: 2 additions & 9 deletions mdparser/mdparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# https://gitlab.hzdr.de/hub-terra/stakeholder-view/-/blob/dev/datahub/stakeholderview/migrations/0015_html_to_md.py

from html.parser import HTMLParser
from tkinter import Image
from typing import List


Expand Down Expand Up @@ -156,15 +155,9 @@ def handle_starttag(self, tag: str, attrs: List) -> None:
else:
self.inside_italic = True
self.output.append(r"*")
elif (
tag == "iframe"
or tag == "centered"
or tag == "center"
or tag == "video"
):
elif tag == "iframe" or tag == "centered" or tag == "center" or tag == "video":
return
else:
raise NotImplementedError(
f"{tag} tags are not implemented.\n\n"
f"Last output: {self.output[-1]}"
f"{tag} tags are not implemented.\n\n" f"Last output: {self.output[-1]}"
)
Loading

0 comments on commit 5ace5f1

Please sign in to comment.