-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update readme Signed-off-by: SammyOina <[email protected]>
- Loading branch information
Showing
16 changed files
with
221 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
/build | ||
|
||
*.cov | ||
|
||
*.BIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,56 @@ | ||
# Copyright (c) Mainflux | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
PROGRAM = mproxy | ||
PROGRAM = aproxy | ||
MF_DOCKER_IMAGE_NAME_PREFIX ?= amdm | ||
SOURCES = $(wildcard *.go) cmd/main.go | ||
CGO_ENABLED ?= 0 | ||
GOARCH ?= amd64 | ||
VERSION ?= $(shell git describe --abbrev=0 --tags 2>/dev/null || echo "0.13.0") | ||
COMMIT ?= $(shell git rev-parse HEAD) | ||
TIME ?= $(shell date +%F_%T) | ||
|
||
all: $(PROGRAM) | ||
|
||
.PHONY: all clean $(PROGRAM) | ||
|
||
define make_docker | ||
docker build \ | ||
--no-cache \ | ||
--build-arg SVC=$(PROGRAM) \ | ||
--build-arg GOARCH=$(GOARCH) \ | ||
--build-arg GOARM=$(GOARM) \ | ||
--build-arg VERSION=$(VERSION) \ | ||
--build-arg COMMIT=$(COMMIT) \ | ||
--build-arg TIME=$(TIME) \ | ||
--tag=$(MF_DOCKER_IMAGE_NAME_PREFIX)/$(PROGRAM) \ | ||
-f docker/Dockerfile . | ||
endef | ||
|
||
define make_docker_dev | ||
docker build \ | ||
--no-cache \ | ||
--build-arg SVC=$(PROGRAM) \ | ||
--tag=$(MF_DOCKER_IMAGE_NAME_PREFIX)/$(PROGRAM) \ | ||
-f docker/Dockerfile.dev ./build | ||
endef | ||
|
||
$(PROGRAM): $(SOURCES) | ||
go build -ldflags "-s -w" -o ./build/$@ cmd/main.go | ||
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) \ | ||
go build -mod=vendor -ldflags "-s -w \ | ||
-X 'github.com/mainflux/mainflux.BuildTime=$(TIME)' \ | ||
-X 'github.com/mainflux/mainflux.Version=$(VERSION)' \ | ||
-X 'github.com/mainflux/mainflux.Commit=$(COMMIT)'" \ | ||
-o ./build/$(MF_DOCKER_IMAGE_NAME_PREFIX)-$(PROGRAM) cmd/main.go | ||
|
||
clean: | ||
rm -rf $(PROGRAM) | ||
|
||
docker-image: | ||
$(call make_docker) | ||
docker-dev: | ||
$(call make_docker_dev) | ||
|
||
run: | ||
docker compose -f ./docker/docker-compose.yml up | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.21.0-alpine AS builder | ||
ARG SVC | ||
ARG GOARCH | ||
ARG GOARM | ||
ARG VERSION | ||
ARG COMMIT | ||
ARG TIME | ||
|
||
WORKDIR /go/src/github.com/absmach/aproxy | ||
COPY . . | ||
RUN apk update \ | ||
&& apk add make\ | ||
&& make $SVC \ | ||
&& mv build/amdm-$SVC /exe | ||
|
||
FROM scratch | ||
# Certificates are needed so that mailing util can work. | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=builder /exe / | ||
ENTRYPOINT ["/exe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM scratch | ||
ARG SVC | ||
COPY amdm-$SVC /exe | ||
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
ENTRYPOINT ["/exe"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.