fix: docker file

This commit is contained in:
王性驊 2025-03-12 14:08:38 +08:00
parent 714163bbe6
commit 4e0a0330ed
3 changed files with 13 additions and 15 deletions

View File

@ -5,7 +5,7 @@ GOFMT ?= gofmt "-s"
GOFILES := $(shell find . -name "*.go")
LDFLAGS := -s -w
VERSION="v1.0.4"
DOCKER_REPO="igs170911/member"
DOCKER_REPO="container.wang/app-cloudep-member-service"
GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
.PHONY: test
@ -31,12 +31,7 @@ run-docker: # 建立 rpc code
.PHONY: build-docker
build-docker:
cp ./build/Dockerfile Dockerfile
docker buildx build \
-t $(DOCKER_REPO):$(VERSION) \
--build-arg VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--secret id=ssh_key,src=./build/id_ed25519 \
--progress=plain .
docker buildx build -t $(DOCKER_REPO):$(VERSION) --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)" .
rm -rf Dockerfile
@echo "Generate core-api files successfully"

View File

@ -1,12 +1,12 @@
###########
# BUILDER #
###########
FROM golang:1.23.4 AS builder
FROM golang:1.24.0 as builder
ARG VERSION
ARG BUILT
ARG GIT_COMMIT
ARG SSH_PRV_KEY
# private go packages
ENV GOPRIVATE=code.30cm.net
@ -16,12 +16,15 @@ COPY . .
RUN apt-get update && \
apt-get install -y git && \
mkdir /root/.ssh
apt-get install git
# Make the root foler for our ssh
RUN --mount=type=secret,id=ssh_key,dst=/root/.ssh/id_rsa \
ssh-keyscan git.30cm.net >> /root/.ssh/known_hosts
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
ssh-keyscan git.30cm.net > /root/.ssh/known_hosts && \
echo "$SSH_PRV_KEY" > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa
RUN --mount=type=ssh go mod download

View File

@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.3
// goctl 1.8.1
// Source: member.proto
package server
@ -8,7 +8,7 @@ import (
"context"
"code.30cm.net/digimon/app-cloudep-member-server/gen_result/pb/member"
accountlogic "code.30cm.net/digimon/app-cloudep-member-server/internal/logic/account"
"code.30cm.net/digimon/app-cloudep-member-server/internal/logic/account"
"code.30cm.net/digimon/app-cloudep-member-server/internal/svc"
)