Try building an image

This commit is contained in:
Nikolai Rodionov 2024-03-19 16:58:05 +01:00
parent fb2795f8f6
commit 5a04907bc5
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
3 changed files with 39 additions and 10 deletions

29
.woodpecker/build.yaml Normal file
View File

@ -0,0 +1,29 @@
---
when:
event:
- push
steps:
build:
image: git.badhouseplants.net/badhouseplants/badhouseplants-builder:ff4a98f2acb557ad443f279627036bebf06bc4f1
name: Build shoebill operator image
privileged: true
environment:
- PACKAGE_NAME=softplayer/softplayer-backend
commands:
- |
if [[ "${CI_COMMIT_TAG}" ]]; then
export CUSTOM_TAG="${CI_COMMIT_TAG}";
fi
- build-container
secrets:
- gitea_token
backend_options:
kubernetes:
resources:
requests:
memory: 500Mi
cpu: 200m
limits:
memory: 1000Mi
cpu: 1000m

View File

@ -4,9 +4,9 @@ WORKDIR /app
COPY go.mod ./ COPY go.mod ./
COPY go.sum ./ COPY go.sum ./
RUN go mod download RUN go mod download
COPY *.go ./ COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /softplayer-backend RUN CGO_ENABLED=0 GOOS=linux go build -o /app
FROM scratch FROM scratch
COPY --from=0 /app/softplayer-backend /bin/softplayer-backend COPY --from=0 /app /app
CMD ["/bin/softplayer-backend"] CMD ["/app"]

View File

@ -19,7 +19,7 @@ type AccountsServer struct {
Controller ctrl.Manager Controller ctrl.Manager
} }
func (a *AccountsServer) SignUp(ctx context.Context, in *accounts.AccountWithPassword) (*accounts.AccountFullWithKubeConfig, error) { func (a *AccountsServer) SignUp(ctx context.Context, in *accounts.AccountWithPassword) (*accounts.AccountFullWithToken, error) {
data := controllers.AccountData{ data := controllers.AccountData{
Username: in.Data.GetName(), Username: in.Data.GetName(),
Password: in.AccountPassword.GetPassword(), Password: in.AccountPassword.GetPassword(),
@ -33,7 +33,7 @@ func (a *AccountsServer) SignUp(ctx context.Context, in *accounts.AccountWithPas
return nil, err return nil, err
} }
return &accounts.AccountFullWithKubeConfig{ return &accounts.AccountFullWithToken{
Id: &accounts.AccountId{ Id: &accounts.AccountId{
Id: acc.Data.UUID, Id: acc.Data.UUID,
}, },
@ -41,11 +41,11 @@ func (a *AccountsServer) SignUp(ctx context.Context, in *accounts.AccountWithPas
Name: acc.Data.Username, Name: acc.Data.Username,
Email: acc.Data.Email, Email: acc.Data.Email,
}, },
Kubeconfig: acc.Kubeconfig, Token: acc.Kubeconfig,
}, nil }, nil
} }
func (a *AccountsServer) SignIn(ctx context.Context, in *accounts.AccountWithPassword) (*accounts.AccountFullWithKubeConfig, error) { func (a *AccountsServer) SignIn(ctx context.Context, in *accounts.AccountWithPassword) (*accounts.AccountFullWithToken, error) {
data := controllers.AccountData{ data := controllers.AccountData{
Username: in.Data.GetName(), Username: in.Data.GetName(),
Password: in.AccountPassword.GetPassword(), Password: in.AccountPassword.GetPassword(),
@ -58,7 +58,7 @@ func (a *AccountsServer) SignIn(ctx context.Context, in *accounts.AccountWithPas
if err := acc.Login(ctx); err != nil { if err := acc.Login(ctx); err != nil {
return nil, err return nil, err
} }
return &accounts.AccountFullWithKubeConfig{ return &accounts.AccountFullWithToken{
Id: &accounts.AccountId{ Id: &accounts.AccountId{
Id: acc.Data.UUID, Id: acc.Data.UUID,
}, },
@ -66,6 +66,6 @@ func (a *AccountsServer) SignIn(ctx context.Context, in *accounts.AccountWithPas
Name: acc.Data.Username, Name: acc.Data.Username,
Email: acc.Data.Email, Email: acc.Data.Email,
}, },
Kubeconfig: acc.Kubeconfig, Token: acc.Kubeconfig,
}, nil }, nil
} }