Skip to content

Commit 110bb5d

Browse files
committed
feat(registry): use docker build
1 parent c3fbe97 commit 110bb5d

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

rootfs/Dockerfile renamed to Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
FROM minio/mc:latest as mc
22

33

4+
FROM drycc/go-dev:latest AS build
5+
ARG LDFLAGS
6+
ADD . /app
7+
RUN export GO111MODULE=on \
8+
&& cd /app \
9+
&& CGO_ENABLED=0 go build -ldflags "${LDFLAGS}" -o /usr/local/bin/boot boot.go
10+
11+
412
FROM alpine:3.12
513

614
RUN adduser \
@@ -10,8 +18,9 @@ RUN adduser \
1018
git \
1119
git
1220

13-
COPY . /
21+
COPY rootfs /
1422
COPY --from=mc /usr/bin/mc /bin/mc
23+
COPY --from=build /usr/local/bin/boot /usr/bin/boot
1524

1625
RUN apk add --update git sudo openssh-server coreutils tar xz jq bash \
1726
&& mkdir -p /var/run/sshd \

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ test-unit:
4343
test-cover:
4444
${DEV_ENV_CMD} test-cover.sh
4545

46-
docker-build: build
47-
docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE} rootfs
46+
docker-build:
47+
docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE} --build-arg LDFLAGS=${LDFLAGS} .
4848
docker tag ${IMAGE} ${MUTABLE_IMAGE}
4949

5050
docker-buildx:
51-
docker buildx build --platform ${PLATFORM} -t ${IMAGE} rootfs --push
51+
docker buildx build --platform ${PLATFORM} -t ${IMAGE} --build-arg LDFLAGS=${LDFLAGS} . --push
5252

5353
check-kubectl:
5454
@if [ -z $$(which kubectl) ]; then \

0 commit comments

Comments
 (0)