Skip to content

Commit

Permalink
162 dockter 1 (#165)
Browse files Browse the repository at this point in the history
* #162 Savepoint

* #162 Savepoint

* #162 Savepoint

* #162 Savepoint

* #162 Savepoint

* #162 Improve docker-compose command

* #162 Improve docker-compose command
  • Loading branch information
docktermj authored Aug 21, 2024
1 parent ede89c4 commit 20fffd4
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 28 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ COPY . ${GOPATH}/src/template-go

# Copy files from prior stage.

COPY --from=senzingapi_runtime "/opt/senzing/g2/lib/" "/opt/senzing/g2/lib/"
COPY --from=senzingapi_runtime "/opt/senzing/g2/sdk/c/" "/opt/senzing/g2/sdk/c/"
COPY --from=senzingapi_runtime "/opt/senzing/er/lib/" "/opt/senzing/er/lib/"
COPY --from=senzingapi_runtime "/opt/senzing/er/sdk/c/" "/opt/senzing/er/sdk/c/"

# Set path to Senzing libs.

ENV LD_LIBRARY_PATH=/opt/senzing/g2/lib/
ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/

# Build go program.

Expand Down Expand Up @@ -77,7 +77,7 @@ USER 1001

# Runtime environment variables.

ENV LD_LIBRARY_PATH=/opt/senzing/g2/lib/
ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/

# Runtime execution.

Expand Down
2 changes: 1 addition & 1 deletion cmd/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
The cmd package is used for Cobra integration.
Package cmd is used for Cobra and Viper integration.
*/
package cmd
3 changes: 2 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
One or two sentence synopsys of the module. The Senzing XXXX module is...
Module template-go...
One or two sentence synopsys of the module.
# Overview
Expand Down
10 changes: 9 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Create a code coverage map.

1. If a web page doesn't appear, visit [localhost:6060].
1. Senzing documentation will be in the "Third party" section.
`github.com` > `senzing` > `go-cmdhelping`
`github.com` > `senzing` > `template-go`

1. When a versioned release is published with a `v0.0.0` format tag,
the reference can be found by clicking on the following badge at the top of the README.md page.
Expand Down Expand Up @@ -212,6 +212,14 @@ Example:

```

To bring the `docker-compose` formation, run

```console
cd ${GIT_REPOSITORY_DIR}
make clean

```

## Package

### Package RPM and DEB files
Expand Down
1 change: 1 addition & 0 deletions examplepackage/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package examplepackage...
One or two sentence synopsis of the package...
# Overview
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/senzing-garage/template-go
go 1.21

require (
github.com/senzing-garage/go-cmdhelping v0.2.3
github.com/senzing-garage/go-cmdhelping v0.3.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/senzing-garage/go-cmdhelping v0.2.3 h1:Jrmi9MO5IXCRQJNJfrT997NyKJBWhLYqceuLL4ihJ2U=
github.com/senzing-garage/go-cmdhelping v0.2.3/go.mod h1:hbiwmnektgCEJ155QYjGxlTOHZbV1eMcOyU9a/qzAS8=
github.com/senzing-garage/go-cmdhelping v0.3.0 h1:6Yo6tYdYXrCuMwsOKdAErwPGvCi8y9PAFV2UVPOffi0=
github.com/senzing-garage/go-cmdhelping v0.3.0/go.mod h1:J6M/yRqP9ZrwuEQFyxZ9JwkvMis8lZeR4Ot4G0u5YMc=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
Expand Down
4 changes: 3 additions & 1 deletion makefiles/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Variables
# -----------------------------------------------------------------------------

SENZING_DIR ?= /opt/senzing/g2
SENZING_DIR ?= /opt/senzing/er
SENZING_TOOLS_SENZING_DIRECTORY ?= $(SENZING_DIR)

LD_LIBRARY_PATH ?= $(SENZING_TOOLS_SENZING_DIRECTORY)/lib:$(SENZING_TOOLS_SENZING_DIRECTORY)/lib/macos
Expand All @@ -25,12 +25,14 @@ clean-osarch-specific:
@docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true
@docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true
@rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true
@rm -f $(MAKEFILE_DIRECTORY)/.coverage || true
@rm -f $(MAKEFILE_DIRECTORY)/coverage.html || true
@rm -f $(MAKEFILE_DIRECTORY)/coverage.out || true
@rm -f $(MAKEFILE_DIRECTORY)/cover.out || true
@rm -fr $(TARGET_DIRECTORY) || true
@rm -fr /tmp/sqlite || true
@pkill godoc || true
@docker-compose -f docker-compose.test.yaml down 2> /dev/null || true


.PHONY: coverage-osarch-specific
Expand Down
17 changes: 9 additions & 8 deletions makefiles/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ clean-osarch-specific:
@rm -fr $(TARGET_DIRECTORY) || true
@rm -fr /tmp/sqlite || true
@pkill godoc || true
@docker-compose -f docker-compose.test.yaml down 2> /dev/null || true


.PHONY: coverage-osarch-specific
Expand All @@ -38,12 +39,6 @@ coverage-osarch-specific:
@xdg-open $(MAKEFILE_DIRECTORY)/coverage.html


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@godoc &
@xdg-open http://localhost:6060


.PHONY: docker-build-osarch-specific
docker-build-osarch-specific:
@$(DOCKER_BUILDKIT) docker build \
Expand All @@ -52,6 +47,12 @@ docker-build-osarch-specific:
.


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@godoc &
@xdg-open http://localhost:6060


.PHONY: hello-world-osarch-specific
hello-world-osarch-specific:
$(info Hello World, from linux.)
Expand All @@ -61,8 +62,8 @@ hello-world-osarch-specific:
package-osarch-specific: docker-build-package
@mkdir -p $(TARGET_DIRECTORY) || true
@CONTAINER_ID=$$(docker create $(DOCKER_BUILD_IMAGE_NAME)); \
@docker cp $$CONTAINER_ID:/output/. $(TARGET_DIRECTORY)/; \
@docker rm -v $$CONTAINER_ID
docker cp $$CONTAINER_ID:/output/. $(TARGET_DIRECTORY)/; \
docker rm -v $$CONTAINER_ID


.PHONY: run-osarch-specific
Expand Down
13 changes: 7 additions & 6 deletions makefiles/windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ clean-osarch-specific:
@del /F /S /Q $(TARGET_DIRECTORY)
@del /F /S /Q C:\Temp\sqlite
@taskkill /f /t/im godoc
@docker-compose -f docker-compose.test.yaml down


.PHONY: coverage-osarch-specific
Expand All @@ -33,12 +34,6 @@ coverage-osarch-specific:
@explorer file://$(MAKEFILE_DIRECTORY)/coverage.html


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@start /b godoc
@explorer http://localhost:6060


.PHONY: docker-build-osarch-specific
docker-build-osarch-specific:
@docker build \
Expand All @@ -47,6 +42,12 @@ docker-build-osarch-specific:
.


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@start /b godoc
@explorer http://localhost:6060


.PHONY: hello-world-osarch-specific
hello-world-osarch-specific:
$(info Hello World, from windows.)
Expand Down
6 changes: 3 additions & 3 deletions package.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Stages
# -----------------------------------------------------------------------------

ARG IMAGE_SENZINGAPI_RUNTIME=senzing/senzingapi-runtime:3.10.1
ARG IMAGE_SENZINGAPI_RUNTIME=senzing/senzingapi-runtime-staging:latest
ARG IMAGE_GO_BUILDER=golang:1.22.3-bullseye
ARG IMAGE_FPM_BUILDER=dockter/fpm:latest
ARG IMAGE_FINAL=alpine
Expand Down Expand Up @@ -117,8 +117,8 @@ ARG PROGRAM_NAME

# Copy files from prior step.

COPY --from=fpm_builder "/output/*" "/output/"
COPY --from=fpm_builder "/output/linux-amd64/${PROGRAM_NAME}" "/output/linux-amd64/${PROGRAM_NAME}"
COPY --from=fpm_builder "/output/*" "/output/"
COPY --from=fpm_builder "/output/linux-amd64/${PROGRAM_NAME}" "/output/linux-amd64/${PROGRAM_NAME}"

USER 1001
CMD ["/bin/bash"]

0 comments on commit 20fffd4

Please sign in to comment.