Compare commits

..

5 Commits

Author SHA1 Message Date
6f04d23e6c Add license information to .dockerignore file
All checks were successful
continuous-integration/drone/pr Build is passing
2024-08-21 21:17:33 +02:00
155ddc556c Add .dockerignore file
Some checks failed
continuous-integration/drone/pr Build is failing
2024-08-21 21:09:12 +02:00
a5a85e6032 Fix Dockerfile warnings 2024-08-21 21:08:52 +02:00
6a3458a596 Pin Docker images in CI 2024-08-21 20:53:59 +02:00
97be8f4667 Ditch builder and base Docker images
This should make dependency upgrades easier and bring more clarity to the CI pipelines
2024-08-21 20:49:47 +02:00
4 changed files with 43 additions and 79 deletions

13
.dockerignore Normal file
View File

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
*
!Pipfile
!Pipfile.lock
!data/
!ki/
!LICENSES/
!migrations/
!app.py
!run_prod.py

View File

@ -15,16 +15,18 @@ trigger:
steps:
- name: install-lint-test
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
image: python:3.8.18-alpine
env:
PYROOT: '/pyroot'
PYTHONUSERBASE: '/pyroot'
commands:
- apk add --no-cache gcc g++ musl-dev python3-dev
- pip3 install pipenv
- pipenv install --dev
- pipenv run flake8
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
image_pull_secrets:
- dockerconfig
---
kind: pipeline
type: docker
@ -41,7 +43,7 @@ depends_on:
steps:
- name: docker-publish
image: plugins/docker
image: plugins/docker:20.17.3
settings:
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/backend
@ -68,7 +70,7 @@ depends_on:
steps:
- name: deploy-dev
image: appleboy/drone-ssh
image: appleboy/drone-ssh:1.7.5
settings:
host:
- dev01.wtf-eg.net
@ -91,14 +93,19 @@ trigger:
steps:
- name: install-lint-test
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
image: python:3.8.18-alpine
env:
PYROOT: '/pyroot'
PYTHONUSERBASE: '/pyroot'
commands:
- apk add --no-cache gcc g++ musl-dev python3-dev
- pip3 install pipenv
- pipenv install --dev
- pipenv run flake8
- pipenv run reuse lint
- pipenv run python -m unittest discover ki
- name: docker-publish
image: plugins/docker
image: plugins/docker:20.17.3
settings:
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/backend

View File

@ -2,7 +2,17 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
FROM git.wtf-eg.de/kompetenzinventar/builder:1.0.2 as builder
FROM python:3.8.18-alpine AS builder
ENV PYROOT=/pyroot
ENV PYTHONUSERBASE=$PYROOT
RUN apk add --no-cache \
gcc \
g++ \
musl-dev \
python3-dev && \
pip3 install pipenv
COPY Pipfile* ./
@ -10,7 +20,10 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
RUN pip3 uninstall --yes pipenv
FROM git.wtf-eg.de/kompetenzinventar/base:1.0.2 as ki-backend
FROM python:3.8.18-alpine AS ki-backend
ENV PYROOT=/pyroot
ENV PYTHONUSERBASE=$PYROOT
# Install six explicitly. Otherwise Python complains about it missing.
RUN pip3 install six

View File

@ -19,8 +19,6 @@ class User(db.Model):
tokens = relationship("Token", back_populates="user")
profile = relationship("Profile", back_populates="user")
jobs = relationship("Job", back_populates="owner")
job_responses = relationship("JobResponse",back_populates="user")
def to_dict(self):
return {"id": self.id}
@ -148,7 +146,6 @@ class Skill(db.Model):
profiles = relationship("ProfileSkill", back_populates="skill")
searchtopics = relationship("ProfileSearchtopic", back_populates="skill")
jobs = relationship("JobSkill", back_populates="skill")
def to_dict(self):
return {"id": self.id, "name": self.name, "icon_url": "/skills/{}/icon".format(self.id)}
@ -231,69 +228,3 @@ class ProfileLanguage(db.Model):
def to_dict(self):
return {"profile_id": self.profile_id, "language": self.language.to_dict(), "level": self.level}
class Job(db.Model):
__tablename__ = "job"
id = Column(Integer, primary_key=True)
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
description = Column(String(5000))
amount_of_people_needed = Column(Integer, nullable=False)
amount_of_weekhours_needed = Column(Integer)
amount_of_payment_hour = Column(Integer)
timeframeImprecise = Column(String(120))
remotePercent = Column(Integer)
location = Column(String(50))
beginDate = Column(DateTime)
endDate = Column(DateTime)
link = Column(String(500))
aidsLevel = Column(Integer) ## Stupid Shit one has to deal with like Teams or weird Apps, Datathrower Webportals...
created = Column(DateTime, nullable=False, default=datetime.now)
updated = Column(DateTime, onupdate=datetime.now, nullable=False, default=datetime.now)
withdrawn = Column(DateTime, nullable=True)
owner = relationship("User", back_populates="jobs")
responses = relationship("JobResponse", back_populates="jobs")
skills = relationship("JobSkill", back_populates="job")
def to_dict(self):
return {"job_id": self.id, "owner_id": self.owner_id, "description": self.description,
"amount_of_people_needed": self.amount_of_people_needed, "amount_of_weekhours_needed": self.amount_of_weekhours_needed,
"amount_of_payment_hour": self.amount_of_payment_hour, "timeframeImprecise": self.timeframeImprecise,
"remotePercent": self.timeframeImprecise, "location": self.location, "beginDate": self.beginDate,
"endDate": self.endDate, "link": self.link, "aidsLevel": self.aidsLevel, "created": self.created,
"updated": self.updated, "withdrawn": self.withdrawn
}
class JobSkill(db.Model):
__tablename__ = "job_skill"
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
skill_id = Column(Integer, ForeignKey("skill.id"), primary_key=True)
level = Column(SmallInteger, nullable=False)
job = relationship("Job", back_populates="skills")
skill = relationship("Skill", back_populates="jobs")
def to_dict(self):
return {"job_id": self.job_id, "skill": self.skill.to_dict(), "level": self.level}
class JobResponse(db.Model):
__tablename__ = "job_response"
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("user.id"), primary_key=True)
created = Column(DateTime, nullable=False, default=datetime.now)
withdrawn = Column(DateTime, nullable=True) # no longer interested/available
job = relationship("Job", back_populates="responses")
user = relationship("User", back_populates="job_responses")
def to_dict(self):
return {
"job": self.job.to_dict(),
"user": self.user.to_dict(),
"created": self.created,
"withdrawn": self.withdrawn
}