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

feat: Migrate service to V2 #52

Merged
merged 17 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

.idea/
vendor/
cmd/device-rfid-llrp-go
cmd/device-rfid-llrp
glide.lock

# snap files
Expand Down Expand Up @@ -58,3 +58,6 @@ venv
internal/llrp/testdata/**/*.json
internal/llrp/testdata/**/*.bytes
!internal/llrp/testdata/roAccessReports/*-00?*

#do not track vscode
.vscode/*
74 changes: 64 additions & 10 deletions Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ https://github.com/cenkalti/backoff/blob/master/LICENSE
edsrzf/mmap-go (BSD-3) https://github.com/edsrzf/mmap-go
https://github.com/edsrzf/mmap-go/blob/master/LICENSE

edgexfoundry/go-mod-core-contracts (Apache 2.0) https://github.com/edgexfoundry/go-mod-core-contracts
https://github.com/edgexfoundry/go-mod-core-contracts/blob/master/LICENSE
edgexfoundry/go-mod-core-contracts/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-core-contracts/v2
https://github.com/edgexfoundry/go-mod-core-contracts/v2/blob/master/LICENSE

edgexfoundry/go-mod-registry (Apache 2.0) https://github.com/edgexfoundry/go-mod-registry
edgexfoundry/go-mod-registry/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-registry/v2
https://github.com/edgexfoundry/go-mod-registry/blob/master/LICENSE

edgexfoundry/device-sdk-go (Apache 2.0) https://github.com/edgexfoundry/device-sdk-go
https://github.com/edgexfoundry/device-sdk-go/blob/master/LICENSE
edgexfoundry/device-sdk-go/v2 (Apache 2.0) https://github.com/edgexfoundry/device-sdk-go/v2
https://github.com/edgexfoundry/device-sdk-go/v2/blob/master/LICENSE

gorilla/mux 1.6.2 (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE
Expand Down Expand Up @@ -123,14 +123,14 @@ https://github.com/OneOfOne/xxhash/blob/master/LICENCE
hashicorp/consul/api (Mozilla Public License 2.0) https://github.com/hashicorp/consul/api
https://github.com/hashicorp/consul/blob/master/LICENSE

edgexfoundry/go-mod-bootstrap (Apache 2.0) https://github.com/edgexfoundry/go-mod-bootstrap
https://github.com/edgexfoundry/go-mod-bootstrap/blob/master/LICENSE
edgexfoundry/go-mod-bootstrap/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-bootstrap/v2
https://github.com/edgexfoundry/go-mod-bootstrap/v2/blob/master/LICENSE

edgexfoundry/go-mod-secrets (Apache 2.0) https://github.com/edgexfoundry/go-mod-secrets
edgexfoundry/go-mod-secret/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-secrets/v2
https://github.com/edgexfoundry/go-mod-secrets/blob/master/LICENSE

edgexfoundry/go-mod-configuration (Apache 2.0) https://github.com/edgexfoundry/go-mod-configuration
https://github.com/edgexfoundry/go-mod-configuration/blob/master/LICENSE
edgexfoundry/go-mod-configuration/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-configuration/v2
https://github.com/edgexfoundry/go-mod-configuration/v2/blob/master/LICENSE

fxamacker/cbor (MIT) https://github.com/fxamacker/cbor/v2
https://github.com/fxamacker/cbor/blob/master/LICENSE
Expand All @@ -155,3 +155,57 @@ https://github.com/go-playground/validator/blob/master/LICENSE

leodido/go-urn (MIT) https://github.com/leodido/go-urn
https://github.com/leodido/go-urn/blob/master/LICENSE

hashicorp/go-multierror (Mozilla Public License 2.0) https://github.com/hashicorp/go-multierror
https://github.com/hashicorp/go-multierror/blob/master/LICENSE

davecgh/go-spew (ISC) https://github.com/davecgh/go-spew
https://github.com/davecgh/go-spew/blob/master/LICENSE

eclipse/paho.mqtt.golang (Eclipse Distribution License) https://github.com/eclipse/paho.mqtt.golang
https://github.com/eclipse/paho.mqtt.golang/blob/master/LICENSE

edgexfoundry/go-mod-messaging/v2 (Apache 2.0) https://github.com/edgexfoundry/go-mod-messaging/v2
https://github.com/edgexfoundry/go-mod-messaging/blob/master/LICENSE

github.com/fatih/color (MIT) https://github.com/fatih/color
https://github.com/fatih/color/blob/master/LICENSE.md

go-redis/redis (BSD-2) https://github.com/go-redis/redis/v7
https://github.com/go-redis/redis/blob/master/LICENSE

gorilla/websocket (BSD-2) https://github.com/gorilla/websocket
https://github.com/gorilla/websocket/blob/master/LICENSE

hashicorp/errwrap (Mozilla Public License 2.0) https://github.com/hashicorp/errwrap
https://github.com/hashicorp/errwrap/blob/master/LICENSE

github.com/hashicorp/go-hclog (MIT) https://github.com/hashicorp/go-hclog
https://github.com/hashicorp/go-hclog/blob/master/LICENSE

github.com/mattn/go-colorable (MIT) https://github.com/mattn/go-colorable
https://github.com/mattn/go-colorable/blob/master/LICENSE

github.com/mattn/go-isatty (MIT) https://github.com/mattn/go-isatty
https://github.com/mattn/go-isatty/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

pmezard/go-difflib (Unspecified) https://github.com/pmezard/go-difflib
https://github.com/pmezard/go-difflib/blob/master/LICENSE

stretchr/testify (MIT) https://github.com/stretchr/testify
https://github.com/stretchr/testify/blob/master/LICENSE

golang.org/x/crypto (Unspecified) https://github.com/golang/crypto
https://github.com/golang/crypto/blob/master/LICENSE

golang.org/x/net (Unspecified) https://github.com/golang/net
https://github.com/golang/net/blob/master/LICENSE

golang.org/x/text (Unspecified) https://github.com/golang/text
https://github.com/golang/text/blob/master/LICENSE

gopkg.in/yaml.v3 (MIT) https://github.com/go-yaml/yaml/
https://github.com/go-yaml/yaml/blob/v3/LICENSE
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ ARG BASE=golang:1.16-alpine3.14
FROM ${BASE} AS builder

ARG MAKE='make build'
ARG ALPINE_PKG_BASE="make git"
ARG ALPINE_PKG_BASE="make git gcc libc-dev zeromq-dev"
ARG ALPINE_PKG_EXTRA=""

RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories
RUN apk add --no-cache ${ALPINE_PKG_BASE} ${ALPINE_PKG_EXTRA}

WORKDIR $GOPATH/src/github.com/edgexfoundry/device-rfid-llrp-go
WORKDIR /app

COPY . .
RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."
Expand All @@ -37,11 +37,15 @@ FROM alpine:3.14
LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2021: Intel'

COPY --from=builder /go/src/github.com/edgexfoundry/device-rfid-llrp-go/LICENSE /
COPY --from=builder /go/src/github.com/edgexfoundry/device-rfid-llrp-go/Attribution.txt /
COPY --from=builder /go/src/github.com/edgexfoundry/device-rfid-llrp-go/cmd /
RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/repositories
RUN apk add --update --no-cache zeromq dumb-init
lenny-goodell marked this conversation as resolved.
Show resolved Hide resolved

COPY --from=builder /app/LICENSE /
COPY --from=builder /app/Attribution.txt /
COPY --from=builder /app/cmd/device-rfid-llrp /device-rfid-llrp
COPY --from=builder /app/cmd/res/ /

EXPOSE 49989
EXPOSE 59989

ENTRYPOINT ["/device-rfid-llrp-go"]
ENTRYPOINT ["/device-rfid-llrp"]
CMD ["-cp=consul.http://edgex-core-consul:8500", "--confdir=/res", "--registry"]
28 changes: 10 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
.PHONY: build test clean prepare update docker

GO = CGO_ENABLED=0 GO111MODULE=on go
GO=CGO_ENABLED=1 GO111MODULE=on go

MICROSERVICES=cmd/device-rfid-llrp-go
MICROSERVICES=cmd/device-rfid-llrp

.PHONY: $(MICROSERVICES)

DOCKERS=docker_device_rfid_llrp_go
.PHONY: $(DOCKERS)

VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)

GIT_SHA=$(shell git rev-parse HEAD)
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-rfid-llrp-go.Version=$(VERSION)"
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-rfid-llrp.Version=$(VERSION)"

build: $(MICROSERVICES)

tidy:
go mod tidy

build: $(MICROSERVICES)

cmd/device-rfid-llrp-go:
cmd/device-rfid-llrp:
$(GO) build $(GOFLAGS) -o $@ ./cmd

test:
Expand All @@ -32,19 +29,14 @@ test:
clean:
rm -f $(MICROSERVICES)

update:
$(GO) mod download

docker: $(DOCKERS)

docker_device_rfid_llrp_go:
docker:
docker build \
--build-arg http_proxy \
marcpfuller marked this conversation as resolved.
Show resolved Hide resolved
--build-arg https_proxy \
--label "git_sha=$(GIT_SHA)" \
-t edgexfoundry/docker-device-rfid-llrp-go:$(GIT_SHA) \
-t edgexfoundry/docker-device-rfid-llrp-go:$(VERSION)-dev \
-t edgexfoundry/device-rfid-llrp:$(GIT_SHA) \
-t edgexfoundry/device-rfid-llrp:$(VERSION)-dev \
.

vendor:
$(GO) mod vendor
go mod vendor
Loading