mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 14:47:33 +00:00
fix: remove operator (#3195)
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
FROM cockroachdb/cockroach:v20.2.3
|
||||
|
||||
RUN microdnf install curl wget tar gzip
|
||||
|
||||
RUN wget https://storage.googleapis.com/oauth2l/latest/linux_amd64.tgz
|
||||
RUN tar zxvf linux_amd64.tgz
|
||||
RUN mv linux_amd64/oauth2l /usr/local/bin/oauth2l && rm -rf linux_amd64
|
||||
|
||||
COPY build/cr-backup/scripts/backup-cockroach.sh /scripts/backup.sh
|
||||
RUN chmod +x /scripts/backup.sh
|
||||
|
||||
COPY build/cr-backup/scripts/restore-cockroach.sh /scripts/restore.sh
|
||||
RUN chmod +x /scripts/restore.sh
|
||||
|
||||
COPY build/cr-backup/scripts/clean-db-cockroach.sh /scripts/clean-db.sh
|
||||
RUN chmod +x /scripts/clean-db.sh
|
||||
COPY build/cr-backup/scripts/clean-migration-cockroach.sh /scripts/clean-migration.sh
|
||||
RUN chmod +x /scripts/clean-migration.sh
|
||||
COPY build/cr-backup/scripts/clean-user-cockroach.sh /scripts/clean-user.sh
|
||||
RUN chmod +x /scripts/clean-user.sh
|
||||
|
||||
ENTRYPOINT [ "/cockroach" ]
|
@@ -1,17 +0,0 @@
|
||||
env=$1
|
||||
bucket=$2
|
||||
db=$3
|
||||
folder=$4
|
||||
safile=$5
|
||||
certs=$6
|
||||
name=$7
|
||||
|
||||
filenamelocal=zitadel-${db}.sql
|
||||
filenamebucket=zitadel-${db}-${name}.sql
|
||||
|
||||
/cockroach/cockroach.sh dump --dump-mode=data --certs-dir=${certs} --host=cockroachdb-public:26257 ${db} > ${folder}/${filenamelocal}
|
||||
curl -X POST \
|
||||
-H "$(oauth2l header --json ${safile} cloud-platform)" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @${folder}/${filenamelocal} \
|
||||
"https://storage.googleapis.com/upload/storage/v1/b/${bucket}/o?uploadType=media&name=${env}/${name}/${filenamebucket}"
|
@@ -1,4 +0,0 @@
|
||||
certs=$1
|
||||
db=$2
|
||||
|
||||
/cockroach/cockroach.sh sql --certs-dir=${certs} --host=cockroachdb-public:26257 -e "DROP DATABASE IF EXISTS ${db} CASCADE;"
|
@@ -1,3 +0,0 @@
|
||||
certs=$1
|
||||
|
||||
/cockroach/cockroach.sh sql --certs-dir=${certs} --host=cockroachdb-public:26257 -e "TRUNCATE defaultdb.flyway_schema_history;"
|
@@ -1,4 +0,0 @@
|
||||
certs=$1
|
||||
db=$2
|
||||
|
||||
/cockroach/cockroach.sh sql --certs-dir=${certs} --host=cockroachdb-public:26257 -e "DROP USER IF EXISTS ${db};"
|
@@ -1,33 +0,0 @@
|
||||
bucket=$1
|
||||
env=$2
|
||||
name=$3
|
||||
db=$4
|
||||
safile=$5
|
||||
certs=$6
|
||||
|
||||
urlencode() {
|
||||
# urlencode <string>
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
filenamelocal=zitadel-${db}.sql
|
||||
filenamebucket=zitadel-${db}-${name}.sql
|
||||
|
||||
curl -X GET \
|
||||
-H "$(oauth2l header --json ${safile} cloud-platform)" \
|
||||
-o "${filenamelocal}" \
|
||||
"https://storage.googleapis.com/storage/v1/b/${bucket}/o/$(urlencode ${env}/${name}/${filenamebucket})?alt=media"
|
||||
|
||||
/cockroach/cockroach.sh sql --certs-dir=${certs} --host=cockroachdb-public:26257 --database=${db} < ${filenamelocal}
|
@@ -1 +0,0 @@
|
||||
**/statik/statik.go
|
@@ -1,65 +0,0 @@
|
||||
#######################
|
||||
## By default we build the prod enviroment
|
||||
ARG ENV=prod
|
||||
|
||||
#######################
|
||||
## Go base build
|
||||
## Speed up this step by mounting your local go mod pkg directory
|
||||
#######################
|
||||
FROM golang:1.16 as go-base
|
||||
|
||||
WORKDIR src/github.com/caos/zitadel/
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
|
||||
## Go test
|
||||
FROM go-base as go-test
|
||||
COPY . .
|
||||
#Migrations for cockroach-secure
|
||||
RUN go install github.com/rakyll/statik
|
||||
RUN ./build/operator/prebuild.sh ./migrations
|
||||
|
||||
RUN go test -race -v -coverprofile=profile.cov ./operator/...
|
||||
|
||||
## Go test
|
||||
FROM scratch as go-codecov
|
||||
COPY --from=go-test /go/src/github.com/caos/zitadel/profile.cov profile.cov
|
||||
|
||||
## Go prod build
|
||||
FROM go-test as prod-go-build
|
||||
|
||||
|
||||
ARG ARCH=amd64
|
||||
ARG OS=linux
|
||||
ARG VERSION=none
|
||||
ARG GITHUBOAUTHCLIENTID=none
|
||||
ARG GITHUBOAUTHCLIENTSECRET=none
|
||||
RUN GOOS=${OS} GOARCH=${ARCH} ./build/operator/build.sh ${VERSION}
|
||||
|
||||
## Go dev build
|
||||
FROM go-base as dev-go-build
|
||||
RUN go get github.com/go-delve/delve/cmd/dlv
|
||||
|
||||
#######################
|
||||
## Final Production Image
|
||||
#######################
|
||||
FROM alpine:latest as artifact
|
||||
RUN adduser -D zitadel
|
||||
|
||||
ARG ARCH=amd64
|
||||
ARG OS=linux
|
||||
|
||||
RUN apk add -U --no-cache ca-certificates
|
||||
|
||||
COPY --from=prod-go-build /go/src/github.com/caos/zitadel/zitadelctl /app/zitadelctl
|
||||
RUN chmod a+x /app/zitadelctl
|
||||
|
||||
## Scratch Image
|
||||
FROM scratch as final
|
||||
COPY --from=artifact /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=artifact /etc/passwd /etc/passwd
|
||||
COPY --from=artifact /app /
|
||||
USER zitadel
|
||||
HEALTHCHECK NONE
|
||||
ENTRYPOINT ["/zitadelctl"]
|
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CGO_ENABLED=0 go build \
|
||||
-a \
|
||||
-installsuffix cgo \
|
||||
-ldflags "$(./build/operator/ldflags.sh "${1}")" \
|
||||
-o zitadelctl \
|
||||
./cmd/zitadelctl/main.go
|
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
VERSION=${1}
|
||||
if [ "${VERSION}" == "" ]; then
|
||||
VERSION="$(git rev-parse --abbrev-ref HEAD | sed -e 's/heads\///')"
|
||||
fi
|
||||
|
||||
echo -n "-extldflags -static -X main.Version=${VERSION} -X main.githubClientID=${GITHUBOAUTHCLIENTID} -X main.githubClientSecret=${GITHUBOAUTHCLIENTSECRET}"
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
statik -src=$1
|
@@ -148,13 +148,13 @@ FROM go-test as prod-go-build
|
||||
ARG BUILDARCH
|
||||
ARG VERSION=""
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${BUILDARCH} go build -a -installsuffix cgo -ldflags "-X main.version=${VERSION:-'dev'} -extldflags \"-static\"" -o zitadel-linux-${BUILDARCH} cmd/zitadel/main.go
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${BUILDARCH} go build -a -installsuffix cgo -ldflags "-X main.version=${VERSION:-'dev'} -extldflags \"-static\"" -o zitadel-linux-${BUILDARCH} main.go
|
||||
|
||||
#######################
|
||||
## Go dev build
|
||||
#######################
|
||||
FROM go-base as dev-go-build
|
||||
ENTRYPOINT [ "go", "run", "cmd/zitadel/main.go" ]
|
||||
ENTRYPOINT [ "go", "run", "main.go" ]
|
||||
|
||||
#######################
|
||||
## Only Copy Assets
|
||||
|
Reference in New Issue
Block a user