Skip to content

Commit

Permalink
chore: refactor config and code for zitadel oidc
Browse files Browse the repository at this point in the history
  • Loading branch information
olevski committed Jan 16, 2024
1 parent db53830 commit b91ca0f
Show file tree
Hide file tree
Showing 63 changed files with 2,195 additions and 3,353 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ helm-chart/renku-gateway/charts/**

# Ignore snyk cache
.dccache

.DS_Store
29 changes: 10 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM python:3.7-slim

RUN pip install --upgrade pip==22.1.2 && \
pip install poetry && \
addgroup renku --gid 1000 && \
adduser renku --uid 1000 --gid 1000

COPY pyproject.toml poetry.lock /code/
WORKDIR /code

RUN poetry config virtualenvs.create false && \
poetry install

COPY ./ /code

FROM golang:1.19.5-alpine3.17 as builder
WORKDIR /src
COPY go.mod go.sum ./
COPY cmd/revproxy/ ./
COPY internal/stickysessions/ ./internal/stickysessions/
RUN go build -o /revproxy

FROM alpine:3.17
USER 1000:1000

CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app", "-k", "gevent"]

EXPOSE 5000
COPY --from=builder /revproxy /revproxy
ENTRYPOINT [ "/revproxy" ]
11 changes: 0 additions & 11 deletions Dockerfile.revproxy

This file was deleted.

64 changes: 17 additions & 47 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,55 +1,25 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PKG_NAME=github.com/SwissDataScienceCenter/renku-gateway

DOCKER_REPOSITORY?=renku/
IMAGE?=renku-gateway
.PHONY: build clean lint format test

DOCKER_LABEL?=$(shell git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //')
ifeq ($(DOCKER_LABEL), master)
DOCKER_LABEL=latest
endif

GIT_MASTER_HEAD_SHA:=$(shell git rev-parse --short=7 --verify HEAD)

# Note that this is the default target executed when typing 'make'
build:
@echo "Building image: docker build -t ${DOCKER_REPOSITORY}${IMAGE}:${GIT_MASTER_HEAD_SHA} ."
@docker build -t ${DOCKER_REPOSITORY}${IMAGE}:${GIT_MASTER_HEAD_SHA} .

tag: build
@echo "Tagging image: docker tag ${DOCKER_REPOSITORY}${IMAGE}:${GIT_MASTER_HEAD_SHA} ${DOCKER_REPOSITORY}${IMAGE}:${DOCKER_LABEL}"
@docker tag ${DOCKER_REPOSITORY}${IMAGE}:${GIT_MASTER_HEAD_SHA} ${DOCKER_REPOSITORY}${IMAGE}:${DOCKER_LABEL}
go build -o ./build/revproxy ${PKG_NAME}/cmd/revproxy
go build -o ./build/login ${PKG_NAME}/cmd/login

push: tag
@echo "Pushing image image: docker push ${DOCKER_REPOSITORY}${IMAGE}:${DOCKER_LABEL}"
@docker push ${DOCKER_REPOSITORY}${IMAGE}:${DOCKER_LABEL}
clean:
go clean
go clean -testcache
rm -f build/*

start:
@echo "Start"
@docker pull ${DOCKER_REPOSITORY}${IMAGE}
@docker run -p 5000:5000 ${DOCKER_REPOSITORY}${IMAGE}
lint:
golangci-lint run --config .golangci.yaml

dev-docker:
@echo "Running development server to develop against renku running inside docker"
FLASK_APP=app:app FLASK_DEBUG=1 HOST_NAME=http://localhost:5000 flask run
format:
go fmt
golines . -w --max-len=120 --base-formatter=gofmt --ignore-generated --shorten-comments

dev:
./run-telepresence.sh
test:
go test -vet=all -race -cover -p 1 ./...

login:
@echo "${DOCKER_PASSWORD}" | docker login -u="${DOCKER_USERNAME}" --password-stdin ${DOCKER_REGISTRY}
openapi:
oapi-codegen -generate types,server,spec -package login apispec.yaml > internal/login/spec.gen.go
207 changes: 0 additions & 207 deletions api/spec.yaml

This file was deleted.

Loading

0 comments on commit b91ca0f

Please sign in to comment.