Updated Dockerfile and woodpecker to use private Gitea login credentials
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
This commit is contained in:
@@ -5,13 +5,21 @@ when:
|
|||||||
steps:
|
steps:
|
||||||
- name: build-and-push-image
|
- name: build-and-push-image
|
||||||
image: harbor.maximumdirect.net/proxy-dockerhub/woodpeckerci/plugin-kaniko
|
image: harbor.maximumdirect.net/proxy-dockerhub/woodpeckerci/plugin-kaniko
|
||||||
|
environment:
|
||||||
|
GITEA_USER:
|
||||||
|
from_secret: GITEA_USER
|
||||||
|
GITEA_TOKEN:
|
||||||
|
from_secret: GITEA_TOKEN
|
||||||
settings:
|
settings:
|
||||||
registry: harbor.maximumdirect.net
|
registry: harbor.maximumdirect.net
|
||||||
repo: build/weatherapi
|
repo: build/weatherapi
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
|
build_args_from_env:
|
||||||
|
- GITEA_USER
|
||||||
|
- GITEA_TOKEN
|
||||||
username:
|
username:
|
||||||
from_secret: HARBOR_ROBOT_USER
|
from_secret: HARBOR_ROBOT_USER
|
||||||
password:
|
password:
|
||||||
from_secret: HARBOR_ROBOT_TOKEN
|
from_secret: HARBOR_ROBOT_TOKEN
|
||||||
cache: true
|
cache: true
|
||||||
cache_repo: build-cache/weatherapi
|
cache_repo: build-cache/weatherapi
|
||||||
|
|||||||
10
Dockerfile
10
Dockerfile
@@ -1,6 +1,8 @@
|
|||||||
# syntax=docker/dockerfile:1.6
|
# syntax=docker/dockerfile:1.6
|
||||||
|
|
||||||
ARG GO_VERSION=1.25
|
ARG GO_VERSION=1.25
|
||||||
|
ARG GITEA_USER
|
||||||
|
ARG GITEA_TOKEN
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Build stage
|
# Build stage
|
||||||
@@ -8,6 +10,8 @@ ARG GO_VERSION=1.25
|
|||||||
FROM harbor.maximumdirect.net/proxy-dockerhub/golang:${GO_VERSION}-bookworm AS build
|
FROM harbor.maximumdirect.net/proxy-dockerhub/golang:${GO_VERSION}-bookworm AS build
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
ARG GITEA_USER
|
||||||
|
ARG GITEA_TOKEN
|
||||||
ENV GOPRIVATE=gitea.maximumdirect.net/ejr/* \
|
ENV GOPRIVATE=gitea.maximumdirect.net/ejr/* \
|
||||||
GONOSUMDB=gitea.maximumdirect.net/ejr/*
|
GONOSUMDB=gitea.maximumdirect.net/ejr/*
|
||||||
|
|
||||||
@@ -19,7 +23,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
# Cache dependencies first
|
# Cache dependencies first
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||||
go mod download && go mod verify
|
if [ -n "${GITEA_USER}" ] && [ -n "${GITEA_TOKEN}" ]; then \
|
||||||
|
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/"; \
|
||||||
|
fi && \
|
||||||
|
go mod download && go mod verify && \
|
||||||
|
rm -f /root/.gitconfig
|
||||||
|
|
||||||
# Copy the rest of the source
|
# Copy the rest of the source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
Reference in New Issue
Block a user