Skip to content

Commit

Permalink
add pr#84 changes - part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpalide committed Dec 22, 2024
1 parent 93f1aa4 commit f7c862e
Show file tree
Hide file tree
Showing 28 changed files with 105 additions and 166 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Check the [docs](docs/Deployments.md) for more documentation on the deployments.

- [Address Resolver](cmd/address-resolver/README.md)
- [Config Bootstrapper](cmd/config-bootstrapper/README.md)
- [Liveness Checker](cmd/liveness-checker/README.md)
- [Network Monitor](cmd/network-monitor/README.md)
- [Public Visor Monitor](cmd/public-visor-monitor/README.md)
- [Route Finder](cmd/route-finder/README.md)
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.7"

networks:
srv:
driver: "bridge"
Expand Down
38 changes: 12 additions & 26 deletions docker/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ trap "exit" INT
## Variables
image_tag="$1"
go_buildopts="$2"
build_arch="$3"
git_branch="$(git rev-parse --abbrev-ref HEAD)"
nv_dev_url="https://nv.skywire.dev/map"
nv_prod_url="https://nv.skycoin.com/map"
Expand All @@ -15,7 +16,7 @@ platform="--platform=linux/amd64"
registry="$REGISTRY"

# shellcheck disable=SC2153
base_image=golang:1.21-alpine
base_image=golang:1.23-alpine

if [[ "$#" != 2 ]]; then
echo "docker_build.sh <IMAGE_TAG> <GO_BUILDOPTS>"
Expand All @@ -25,6 +26,10 @@ if [[ "$go_buildopts" == "" ]]; then
go_buildopts="-mod=vendor -ldflags\"-w -s\""
fi

if [[ "$build_arch" != "" ]]; then
platform="--platform=$build_arch"
fi

if [[ "$git_branch" != "master" ]] && [[ "$git_branch" != "develop" ]]; then
git_branch="develop"
fi
Expand Down Expand Up @@ -65,13 +70,15 @@ if [[ "$image_tag" == "e2e" ]]; then
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
--build-arg base_image="skycoin/dmsg-discovery:$dockerhub_image_tag" \
$platform \
-t "$registry"/dmsg-discovery:"$image_tag" .

echo "build dmsg server image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/dmsg-server/Dockerfile \
--build-arg base_image="skycoin/dmsg-server:$dockerhub_image_tag" \
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
$platform \
-t "$registry"/dmsg-server:"$image_tag" .

echo "build service discovery image"
Expand All @@ -81,13 +88,6 @@ if [[ "$image_tag" == "e2e" ]]; then
--build-arg image_tag="$image_tag" \
$platform \
-t "$registry"/service-discovery:"$image_tag" .

echo "building uptime tracker image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/uptime-tracker/Dockerfile \
--build-arg base_image="$base_image" \
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
-t "$registry"/uptime-tracker:"$image_tag" .

rm -rf ./tmp/skycoin-service-discovery
fi
Expand All @@ -97,41 +97,36 @@ if [[ "$image_tag" == "integration" ]]; then
rm -rf ./tmp/skycoin-service-discovery
rm -rf ./tmp/dmsg
rm -rf ./tmp/skywire
rm -rf ./tmp/skywire-ut
cp -r ../skycoin-service-discovery ./tmp
cp -r ../dmsg ./tmp
cp -r ../skywire ./tmp
cp -r ../skywire-ut ./tmp

echo ====================================================
echo "BUILDING SKYWIRE VISOR"

DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/skywire-visor/DockerfileInt \
$platform \
-t "$registry"/skywire-visor:"$image_tag" .

echo ============ Base images ready ======================

echo "build dmsg discovery image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/dmsg-discovery/DockerfileInt \
$platform \
-t "$registry"/dmsg-discovery:"$image_tag" .

echo "build dmsg server image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/dmsg-server/DockerfileInt \
$platform \
-t "$registry"/dmsg-server:"$image_tag" .

echo "build service discovery image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/service-discovery/Dockerfile \
--build-arg base_image="$base_image" \
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
$platform \
-t "$registry"/service-discovery:"$image_tag" .

echo "building uptime tracker image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/uptime-tracker/Dockerfile \
--build-arg base_image="$base_image" \
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
-t "$registry"/uptime-tracker:"$image_tag" .

rm -rf ./tmp/*
fi
Expand Down Expand Up @@ -176,7 +171,6 @@ DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/uptime-tracker/Dockerfil
$platform \
-t "$registry"/uptime-tracker:"$image_tag" .


echo "build node visualizer image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/node-visualizer/Dockerfile \
--build-arg base_image="$base_image" \
Expand All @@ -193,14 +187,6 @@ DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/network-monitor/Dockerfi
$platform \
-t "$registry"/network-monitor:"$image_tag" .

echo "building liveness checker image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/liveness-checker/Dockerfile \
--build-arg base_image="$base_image" \
--build-arg build_opts="$go_buildopts" \
--build-arg image_tag="$image_tag" \
$platform \
-t "$registry"/liveness-checker:"$image_tag" .

echo "building config bootstrapper image"
DOCKER_BUILDKIT="$bldkit" docker build -f docker/images/config-bootstrapper/Dockerfile \
--build-arg base_image="$base_image" \
Expand Down
1 change: 0 additions & 1 deletion docker/docker_clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ declare -a images_arr=(
"skycoin/network-monitor:${image_tag}"
"skycoin/node-visualizer:${image_tag}"
"skycoin/config-bootstrapper:${image_tag}"
"skycoin/liveness-checker:${image_tag}"
"skycoin/vpn-monitor:${image_tag}"
"skycoin/public-visor-monitor:${image_tag}"
"skycoin/dmsg-monitor:${image_tag}"
Expand Down
1 change: 0 additions & 1 deletion docker/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ declare -a images_arr=(
"network-monitor"
"node-visualizer"
"config-bootstrapper"
"liveness-checker"
"vpn-monitor"
"public-visor-monitor"
"dmsg-monitor"
Expand Down
10 changes: 5 additions & 5 deletions docker/images/address-resolver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG base_image
ARG image_tag

FROM ${base_image} as builder
FROM ${base_image} AS builder

ARG build_opts

Expand All @@ -12,14 +12,14 @@ RUN go build "${build_opts}" -o /release/address-resolver \
./cmd/address-resolver


FROM alpine as prod
FROM alpine AS prod
COPY --from=builder /release/address-resolver /release/address-resolver
ENTRYPOINT ["/release/address-resolver"]

FROM prod as test
FROM prod AS test

# OS image
FROM alpine as e2e
FROM alpine AS e2e

COPY ./docker/common/install-prequisites.sh /release/install-prequisites.sh
RUN sh -c /release/install-prequisites.sh cert-only \
Expand All @@ -28,6 +28,6 @@ RUN sh -c /release/install-prequisites.sh cert-only \
COPY --from=builder /release/address-resolver /release/address-resolver
ENTRYPOINT ["/release/address-resolver"]

FROM e2e as integration
FROM e2e AS integration

FROM ${image_tag}
10 changes: 5 additions & 5 deletions docker/images/config-bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG image_tag
ARG base_image

FROM ${base_image} as builder
FROM ${base_image} AS builder

ARG build_opts

Expand All @@ -11,15 +11,15 @@ WORKDIR /skywire-services
RUN go build "${build_opts}" -o /release/config-bootstrapper ./cmd/config-bootstrapper && \
mv /skywire-services/docker/config/config.json /release/config.json

FROM alpine as prod
FROM alpine AS prod
COPY --from=builder /release/config-bootstrapper /release/config-bootstrapper
COPY --from=builder /release/config.json /release/config.json
ENTRYPOINT ["/release/config-bootstrapper"]

FROM prod as test
FROM prod AS test

# OS image
FROM alpine as e2e
FROM alpine AS e2e

COPY ./docker/common/install-prequisites.sh /release/install-prequisites.sh
RUN sh -c /release/install-prequisites.sh cert-only \
Expand All @@ -29,6 +29,6 @@ COPY --from=builder /release/config-bootstrapper /release/config-bootstrapper
COPY --from=builder /release/config.json /release/config.json
ENTRYPOINT ["/release/config-bootstrapper"]

FROM e2e as integration
FROM e2e AS integration

FROM ${image_tag}
6 changes: 3 additions & 3 deletions docker/images/dmsg-discovery/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG image_tag
ARG base_image

FROM ${base_image} as prod
FROM ${base_image} AS prod

FROM ${base_image} as test
FROM ${base_image} AS test
# OS image
FROM ${base_image} as e2e
FROM ${base_image} AS e2e

FROM ${image_tag}
4 changes: 1 addition & 3 deletions docker/images/dmsg-discovery/DockerfileInt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.23-alpine AS builder
ARG CGO_ENABLED=0

ENV CGO_ENABLED=${CGO_ENABLED} \
GOOS=linux \
GOARCH=amd64 \
GO111MODULE=on

COPY /tmp/dmsg /dmsg
Expand Down
10 changes: 5 additions & 5 deletions docker/images/dmsg-monitor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG image_tag
ARG base_image

FROM ${base_image} as builder
FROM ${base_image} AS builder

ARG build_opts

Expand All @@ -10,16 +10,16 @@ WORKDIR /skywire-services

RUN go build "${build_opts}" -o /release/dmsg-monitor ./cmd/dmsg-monitor

FROM alpine as prod
FROM alpine AS prod

WORKDIR /release
COPY --from=builder /release/dmsg-monitor /release/dmsg-monitor
ENTRYPOINT ["/release/dmsg-monitor"]

FROM prod as test
FROM prod AS test

# OS image
FROM alpine as e2e
FROM alpine AS e2e
WORKDIR /release

COPY ./docker/common/install-prequisites.sh /release/install-prequisites.sh
Expand All @@ -29,6 +29,6 @@ RUN sh -c /release/install-prequisites.sh cert-only \
COPY --from=builder /release/dmsg-monitor /release/dmsg-monitor
ENTRYPOINT ["/release/dmsg-monitor"]

FROM e2e as integration
FROM e2e AS integration

FROM ${image_tag}
6 changes: 3 additions & 3 deletions docker/images/dmsg-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG image_tag
ARG base_image

FROM ${base_image} as prod
FROM ${base_image} AS prod

FROM ${base_image} as test
FROM ${base_image} AS test
# OS image
FROM ${base_image} as e2e
FROM ${base_image} AS e2e

FROM ${image_tag}
4 changes: 1 addition & 3 deletions docker/images/dmsg-server/DockerfileInt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.23-alpine AS builder
ARG CGO_ENABLED=0

ENV CGO_ENABLED=${CGO_ENABLED} \
GOOS=linux \
GOARCH=amd64 \
GO111MODULE=on

COPY /tmp/dmsg /dmsg
Expand Down
38 changes: 0 additions & 38 deletions docker/images/liveness-checker/Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions docker/images/network-monitor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG image_tag
ARG base_image

FROM ${base_image} as builder
FROM ${base_image} AS builder

ARG build_opts

Expand All @@ -11,16 +11,16 @@ WORKDIR /skywire-services
RUN go build "${build_opts}" -o /release/network-monitor ./cmd/network-monitor && \
go build "${build_opts}" -o /release/vpn-client ./cmd/vpn-lite-client

FROM alpine as prod
FROM alpine AS prod
WORKDIR /release
COPY --from=builder /release/vpn-client /apps/vpn-client
COPY --from=builder /release/network-monitor /release/network-monitor
ENTRYPOINT ["/release/network-monitor"]

FROM prod as test
FROM prod AS test

# OS image
FROM alpine as e2e
FROM alpine AS e2e
WORKDIR /release

COPY ./docker/common/install-prequisites.sh /release/install-prequisites.sh
Expand All @@ -31,6 +31,6 @@ COPY --from=builder /release/vpn-client /release/vpn-client
COPY --from=builder /release/network-monitor /release/network-monitor
ENTRYPOINT ["/release/network-monitor"]

FROM e2e as integration
FROM e2e AS integration

FROM ${image_tag}
Loading

0 comments on commit f7c862e

Please sign in to comment.