Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push to dockerhub on push to develop or master #749

Merged
merged 13 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
sudo: required
language: go
go:
# - "1.16.x" At minimum the code should run make check on the latest two go versions in the default linux environment provided by Travis.
- "1.16.x"

dist: xenial

services:
- docker

addons:
apt:
packages:
Expand Down Expand Up @@ -35,3 +39,10 @@ script:
- make install-deps-ui
- make lint-ui
- make build-ui

deploy:
provider: script
script: make docker-push
on:
type: push
condition: $TRAVIS_BRANCH =~ ^(develop|master)$
jdknives marked this conversation as resolved.
Show resolved Hide resolved
25 changes: 24 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ VERSION := $(shell git describe)
RFC_3339 := "+%Y-%m-%dT%H:%M:%SZ"
DATE := $(shell date -u $(RFC_3339))
COMMIT := $(shell git rev-list -1 HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
jdknives marked this conversation as resolved.
Show resolved Hide resolved

PROJECT_BASE := github.com/skycoin/skywire
DMSG_BASE := github.com/skycoin/dmsg
Expand All @@ -24,6 +25,16 @@ DOCKER_IMAGE?=skywire-runner # docker image to use for running skywire-visor.`go
DOCKER_NETWORK?=SKYNET
DOCKER_NODE?=SKY01
DOCKER_OPTS?=GO111MODULE=on GOOS=linux # go options for compiling for docker container
DOCKER_VISOR_IMAGE_NAME?=skywire
DOCKER_VCS_REF?=${BRANCH}-${COMMIT}
DOCKER_IMAGE_TAG_NAME:=""
ifeq (${BRANCH},master)
jdknives marked this conversation as resolved.
Show resolved Hide resolved
DOCKER_IMAGE_TAG_NAME:=latest
endif
ifeq (${BRANCH},develop)
DOCKER_IMAGE_TAG_NAME:=test
endif


TEST_OPTS:=-cover -timeout=5m -mod=vendor

Expand Down Expand Up @@ -159,7 +170,19 @@ build-ui: install-deps-ui ## Builds the UI

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
docker image build --tag=skywire-runner --rm - < skywire-runner.Dockerfile
#docker image build --tag=skywire-runner --rm - < skywire-runner.Dockerfile
jdknives marked this conversation as resolved.
Show resolved Hide resolved
docker image build \
--tag=skycoin/skywire:${DOCKER_IMAGE_TAG_NAME} \
--build-arg BUILD_DATE=${DATE} \
--build-arg VCS_REF=${DOCKER_VCS_REF} \
--build-arg IMG_NAME=skywire \
-f ./docker/images/visor/Dockerfile .

docker-push: docker-image
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
docker tag skycoin/skywire:${DOCKER_IMAGE_TAG_NAME} skycoin/skywire:${DOCKER_IMAGE_TAG_NAME}
#docker container commit ${COMMIT} skycoin/skywire:${DOCKER_IMAGE_TAG_NAME}
jdknives marked this conversation as resolved.
Show resolved Hide resolved
docker image push skycoin/skywire:${DOCKER_IMAGE_TAG_NAME}

docker-clean: ## Clean docker system: remove container ${DOCKER_NODE} and network ${DOCKER_NETWORK}
-docker network rm ${DOCKER_NETWORK}
Expand Down
10 changes: 10 additions & 0 deletions docker/images/visor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ RUN go build -mod=vendor -tags netgo -ldflags="-w -s" \
## Resulting image
FROM ${base} as visor-runner

ARG BUILD_DATE
ARG VCS_REF
ARG IMG_NAME

COPY --from=builder /go/skywire/skywire-visor skywire-visor
COPY --from=builder /go/skywire/apps bin/apps
COPY --from=builder /go/skywire/docker/images/visor/update.sh update.sh
Expand All @@ -35,3 +39,9 @@ ENTRYPOINT [ "./skywire-visor" ]

# default target
FROM visor-runner

LABEL org.opencontainers.image.created="${BUILD_DATE}" \
jdknives marked this conversation as resolved.
Show resolved Hide resolved
org.opencontainers.image.title="${IMG_NAME}" \
org.opencontainers.image.authors="skycoin" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.vendor="skycoin"
Empty file modified docker/images/visor/update.sh
100644 → 100755
Empty file.