fixes
This commit is contained in:
parent
ec4164a9e2
commit
93e4cdaa74
@ -1,19 +1,21 @@
|
|||||||
# Builder
|
# Builder
|
||||||
ARG BUILDER_IMAGE="git.pbiernat.dev/egommerce/identity-builder:latest"
|
ARG BUILDER_IMAGE
|
||||||
FROM ${BUILDER_IMAGE} AS builder
|
FROM ${BUILDER_IMAGE} AS builder
|
||||||
|
|
||||||
# Destination image - server
|
# Destination image - server
|
||||||
# FROM gcr.io/distroless/base-debian10
|
# FROM gcr.io/distroless/base-debian10
|
||||||
FROM alpine:3.17
|
FROM alpine:3.17
|
||||||
|
|
||||||
ARG BIN_OUTPUT
|
|
||||||
ARG SVC_NAME
|
ARG SVC_NAME
|
||||||
ARG SVC_VER
|
ARG SVC_VER
|
||||||
|
ARG BIN_OUTPUT
|
||||||
|
ARG BUILD_TIME
|
||||||
|
|
||||||
LABEL dev.egommerce.image.author="Piotr Biernat"
|
LABEL dev.egommerce.image.author="Piotr Biernat"
|
||||||
LABEL dev.egommerce.image.vendor="Egommerce"
|
LABEL dev.egommerce.image.vendor="Egommerce"
|
||||||
LABEL dev.egommerce.image.service=${SVC_NAME}
|
LABEL dev.egommerce.image.service=${SVC_NAME}
|
||||||
LABEL dev.egommerce.image.version=${SVC_VER}
|
LABEL dev.egommerce.image.version=${SVC_VER}
|
||||||
|
LABEL dev.egommerce.image.build_time=${BUILD_TIME}
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=builder $BIN_OUTPUT /app
|
COPY --from=builder $BIN_OUTPUT /app
|
||||||
|
@ -2,39 +2,41 @@
|
|||||||
# RUN IN REPO ROOT DIR !!
|
# RUN IN REPO ROOT DIR !!
|
||||||
|
|
||||||
export IMAGE_PREFIX="git.pbiernat.dev/egommerce/identity"
|
export IMAGE_PREFIX="git.pbiernat.dev/egommerce/identity"
|
||||||
export BUILDER_IMAGE="$IMAGE_PREFIX-builder:tmp"
|
export BUILDER_IMAGE="egommerce-builder:identity"
|
||||||
|
export BUILD_TIME=$(date +"%Y%m%d%H%M%S")
|
||||||
export SERVER_IMAGE="$IMAGE_PREFIX-svc"
|
export SERVER_IMAGE="$IMAGE_PREFIX-svc"
|
||||||
# export WORKER_IMAGE="$IMAGE_PREFIX-worker"
|
# export WORKER_IMAGE="$IMAGE_PREFIX-worker"
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
TARGET=${1:-latest}
|
TARGET=${1:-latest}
|
||||||
|
|
||||||
[ ! -d \"src/vendor\" ] && sh -c "cd src; go mod vendor"
|
[ ! -d \"src/vendor\" ] && sh -c "cd src; go mod vendor"
|
||||||
|
|
||||||
export DOCKER_BUILDKIT=1
|
echo "Building tmp $BUILDER_IMAGE image..."
|
||||||
|
docker build --rm -t $BUILDER_IMAGE -f Dockerfile.builder .
|
||||||
|
|
||||||
docker build -t "$BUILDER_IMAGE" -f Dockerfile.builder . && echo "Successfully tagged $BUILDER_IMAGE"
|
|
||||||
|
|
||||||
echo "Building target $IMAGE_PREFIX images..."
|
|
||||||
if [ $TARGET = "latest" ]
|
if [ $TARGET = "latest" ]
|
||||||
then
|
then
|
||||||
# SERVER
|
# SERVER
|
||||||
docker build --build-arg SVC_NAME=identity-svc --build-arg SVC_VER="1.0" --build-arg BIN_OUTPUT=/go/bin/server \
|
docker build --build-arg SVC_NAME=identity-svc --build-arg SVC_VER="1.0" --build-arg BIN_OUTPUT=/go/bin/server \
|
||||||
--rm --build-arg BUILDER_IMAGE --cache-from "$SERVER_IMAGE:$TARGET" -t "$SERVER_IMAGE:$TARGET" \
|
--build-arg BUILDER_IMAGE=$BUILDER_IMAGE --build-arg BUILD_TIME --rm --cache-from $SERVER_IMAGE:$TARGET -t $SERVER_IMAGE:$TARGET \
|
||||||
-f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $SERVER_IMAGE:$TARGET" &
|
-f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $SERVER_IMAGE:$TARGET"
|
||||||
|
# docker tag $SERVER_IMAGE:$TARGET $SERVER_IMAGE:$TARGET
|
||||||
|
|
||||||
# WORKER
|
# WORKER
|
||||||
# docker build --build-arg SVC_NAME=identity-worker --build-arg SVC_VER="1.0" --build-arg BIN_OUTPUT=/go/bin/worker \
|
# docker build --build-arg SVC_NAME=identity-worker --build-arg SVC_VER="1.0" --build-arg BIN_OUTPUT=/go/bin/worker \
|
||||||
# --rm --build-arg BUILDER_IMAGE --cache-from "$WORKER_IMAGE:$TARGET" -t "$WORKER_IMAGE:$TARGET" \
|
# --build-arg BUILDER_IMAGE=$BUILDER_IMAGE --build-arg BUILD_TIME --rm --cache-from $WORKER_IMAGE:$TARGET -t $WORKER_IMAGE:$TARGET \
|
||||||
# -f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $WORKER_IMAGE:$TARGET"
|
# -f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $WORKER_IMAGE:$TARGET"
|
||||||
else
|
else
|
||||||
# SERVER
|
# SERVER
|
||||||
docker build --build-arg SVC_NAME=identity-svc --build-arg SVC_VER="dev" --build-arg BIN_OUTPUT=/go/bin/server \
|
docker build --build-arg SVC_NAME=identity-svc --build-arg SVC_VER="dev" --build-arg BIN_OUTPUT=/go/bin/server \
|
||||||
--rm --build-arg BUILDER_IMAGE --no-cache -t "$SERVER_IMAGE:$TARGET" \
|
--build-arg BUILDER_IMAGE=$BUILDER_IMAGE --build-arg BUILD_TIME --rm --no-cache -t $SERVER_IMAGE:$TARGET \
|
||||||
-f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $SERVER_IMAGE:$TARGET" &
|
-f Dockerfile.target . && echo "Successfully tagged $SERVER_IMAGE:$TARGET"
|
||||||
|
# docker tag $SERVER_IMAGE:$TARGET $SERVER_IMAGE:$TARGET
|
||||||
|
|
||||||
# WORKER
|
# WORKER
|
||||||
# docker build --build-arg SVC_NAME=identity-worker --build-arg SVC_VER="dev" --build-arg BIN_OUTPUT=/go/bin/worker \
|
# docker build --build-arg SVC_NAME=identity-worker --build-arg SVC_VER="dev" --build-arg BIN_OUTPUT=/go/bin/worker \
|
||||||
# --rm --build-arg BUILDER_IMAGE --no-cache -t "$WORKER_IMAGE:$TARGET" \
|
# --build-arg BUILDER_IMAGE=$BUILDER_IMAGE --build-arg BUILD_TIME --rm --no-cache -t "$WORKER_IMAGE:$TARGET" \
|
||||||
# -f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $WORKER_IMAGE:$TARGET"
|
# -f Dockerfile.target . >/dev/null 2>&1 && echo "Successfully tagged $WORKER_IMAGE:$TARGET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# RUN IN REPO ROOT DIR !!
|
# RUN IN REPO ROOT DIR !!
|
||||||
|
|
||||||
export IMAGE_NAME="git.pbiernat.dev/egommerce/identity-svc"
|
export IMAGE_BASE="git.pbiernat.dev/egommerce/identity"
|
||||||
|
export SERVER_IMAGE="$IMAGE_BASE-svc"
|
||||||
|
# export WORKER_IMAGE="$IMAGE_BASE-worker"
|
||||||
|
|
||||||
|
TARGET=${1:-latest}
|
||||||
|
|
||||||
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin
|
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin
|
||||||
docker push "$IMAGE_NAME:latest"
|
docker push "$SERVER_IMAGE:$TARGET"
|
||||||
|
# docker push "$WORKER_IMAGE:$TARGET"
|
||||||
|
@ -3,13 +3,12 @@ module git.pbiernat.dev/egommerce/identity-service
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.101
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.103
|
||||||
github.com/gofiber/fiber/v2 v2.40.1
|
github.com/gofiber/fiber/v2 v2.40.1
|
||||||
github.com/gofiber/jwt/v2 v2.2.7
|
github.com/gofiber/jwt/v2 v2.2.7
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||||
github.com/jackc/pgx/v4 v4.17.2
|
github.com/jackc/pgx/v4 v4.17.2
|
||||||
github.com/joho/godotenv v1.4.0
|
github.com/joho/godotenv v1.4.0
|
||||||
github.com/streadway/amqp v1.0.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.101 h1:NZCFAAlC94+LcN1gjrENnWUHvpWgaNksyB2N4Fiy8C4=
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.103 h1:tVSHVQOBDe1Ofcbodaa/R5gHRD4gYO/d1tw7rVuLJuA=
|
||||||
git.pbiernat.dev/egommerce/go-api-pkg v0.0.101/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
git.pbiernat.dev/egommerce/go-api-pkg v0.0.103/go.mod h1:nAwcw2MZtn/54YKq8VQK6RJAsiuoLUtPuazXg8JcqK8=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||||
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||||
@ -209,8 +209,6 @@ github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXY
|
|||||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=
|
|
||||||
github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
|
Loading…
Reference in New Issue
Block a user