sclorg / golang-container Goto Github PK
View Code? Open in Web Editor NEWGolang container image sources
License: MIT License
Golang container image sources
License: MIT License
Using imagestream from PR #4:
>>> oc create -f golang-centos7-image-streams.json
>>> oc new-app golang~http://github.com/cpuguy83/go-md2man
--> Found image 8547624 (7 days old) in image stream "myproject/golang" under tag "1.8" for "golang"
Go 1.8
------
Go 1.8 available as docker container is a base platform for building and running various Go 1.8 applications and frameworks. Go is an easy to learn, powerful, statically typed language in the C/C++ tradition with garbage collection, concurrent programming support, and memory safety features.
Tags: builder, golang, golang18, rh-golang18, go
* A source build using source code from http://github.com/cpuguy83/go-md2man will be created
* The resulting image will be pushed to image stream "go-md2man:latest"
* Use 'start-build' to trigger a new build
* This image will be deployed in deployment config "go-md2man"
* The image does not expose any ports - if you want to load balance or send traffic to this component
you will need to create a service with 'expose dc/go-md2man --port=[port]' later
--> Creating resources ...
imagestream "go-md2man" created
buildconfig "go-md2man" created
deploymentconfig "go-md2man" created
--> Success
Build scheduled, use 'oc logs -f bc/go-md2man' to track its progress.
Run 'oc status' to view your app.
>>> oc logs go-md2man-1-wpmbm
/usr/libexec/s2i/run: line 5: /opt/app-root/gobinary: No such file or directory
Build and deploy went fine, the last is the resulting pod, which fails.
A common patten for golang projects are to have the main
package within the <cmd>/<binary>
folder with no .go
files located in the project root. This causes a failure when attempting to perform an S2I build as the go list -f {{.Incomplete}}
command fails.
This is for testing of automation workflow. No further action is required.
Currently, the images are tagged as latest
and this makes it very difficult to figure out which version of golang is being used. It would be very useful if we could tag the images with go version.
For instance, centos/go-toolset-7-centos7:1.10
shows which version of golang is installed compared to centos/go-toolset-7-centos7/
.
We use the centos image in https://github.com/golang-starters/golang-http-crud/blob/master/.openshiftio/application.yaml#L46 and there is a possibility that the project wouldn't build if the centos image was rebuilt and the go version changed from go 1.10 to 1.11.
Adding a version tag would be a minor change but it would be immensely useful.
The following image stream has a hardcoded value of 1.16.7.
https://github.com/sclorg/golang-container/blob/master/imagestreams/golang-rhel.json#L62
The latest image available is 1.16.12 https://catalog.redhat.com/software/containers/ubi8/go-toolset/5ce8713aac3db925c03774d1
As this repository is responsible for sycning the image streams into the Openshift clusters samples operator https://github.com/openshift/library/blob/master/arch/x86_64/official/golang/imagestreams/golang-rhel.json. The imagestreams.json needs to be up to date.
The best fix would be to introduce a 1.16 tag which can then track the point release updates however it appears the Red Hat official image does not currently have this tag and only 1.16.12 or latest.
The assemble script used currently supports very limited features. We should improve the assemble script and build something similar to https://github.com/amsokol/openshift-golang-template/blob/master/S2I/.s2i/bin/assemble
Currently only the tags 1
and latest
are published to https://hub.docker.com/r/centos/go-toolset-7-centos7/tags/ though most Go applications need to be pinned to certain minor release numbers.
I'd suggest that this tag strategy should be used:
latest
- the version latest, follows 1
until 2
exists and then it would match that1
- the latest 1.x version1.11
, 1.10
, 1.9
, etc - match the .x version of Go.Hello, we would like to use the s2i golang library to build Go functions in Knative Functions. The function project looks like this:
❯ tree .
.
├── README.md
├── faas
│ └── main.go
├── func.yaml
├── go.mod
├── go.sum
├── handle.go
└── handle_test.go
As you can see, the main.go
file is in the faas
subdirectory. However, with the golang s2i builder image, there is no way to specify this in the command. A similar feature exists, for example, in paketo buildpacks, allowing developers to set the environment variable BP_GO_TARGETS
, resulting in a build command that looks like this:
go build -o /layers/paketo-buildpacks_go-build/targets/bin -buildmode pie -trimpath ./faas
Could something similar be added to the golang s2i builder to enable this functionality?
this issue is created for the testing purpose no action required
go-toolset-7-golang was updated to version 1.10. Because of that fact tests are failing (version 1.8 is expected).
@jcajka What to do?
Tests can be fixed to expect new version. But the directory 1.8
be renamed to 1.10
?
https://github.com/sclorg/golang-container/blob/master/1.10/s2i/bin/assemble#L36
assumes that vendor directory is referenced from INSTALL_URL only.
However vendor dir can be any higher in directory structure.
Usually it is where IMPORT_URL points.
Fix proposal:
Here is my s2i assemble overridden script:
https://github.com/matihost/learning/blob/master/go/.s2i/bin/assemble
making project supporting https://github.com/golang-standards/project-layout structure build-able.
and usage:
https://github.com/matihost/learning/blob/master/go/Makefile#L67
Hi, I'm trying to build https://github.com/jarifibrahim/golang-health-check/tree/without-s2i using the command
➜ golang-health-check git:(without-s2i) s2i build . centos/go-toolset-7-centos7:latest test-app
/tmp/src ~
This is a S2I golang-1.10 centos base image:
To use it, install S2I: https://github.com/openshift/source-to-image
Sample invocation:
s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' git://github.com/cpuguy83/go-md2man centos/golang-1.10-centos go-sample-app
You can then run the resulting image via:
docker run go-sample-app
Build completed successfully
➜ golang-health-check git:(without-s2i) docker run test-app
/usr/libexec/s2i/run: line 5: /opt/app-root/gobinary: No such file or directory
➜ golang-health-check git:(without-s2i)
The assemble script succeeds without any error or explanation but the built container doesn't work.
Please add support for golang 1.18. We would like to use the latest azblob library in our OpenShift application, but the library requires go 1.18 or higher: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#section-readme
Thanks
Hello
I'm trying to deploy a go application with 2 external packages (gorilla mux and go-sql-driver). The deployment works but if I want to start the container, the container goes into a crash loop back off with the following error message:
/usr/libexec/s2i/run: line 5: /opt/app-root/gobinary: No such file or directory
I've also added a deployment log file if that helps.
Thank you for your help
I am trying to build https://github.com/golang-starters/golang-rest-http project using the builder image go-toolset-7-centos7:latest
but it fails with the following error.
➜ golang-rest-http git:(master) s2i build -e IMPORT_URL='github.com/golang-starters/golang-rest-http' . centos/go-toolset-7-centos7:latest test-app
/tmp/src ~
~
Assembling GOPATH
Resolving dependencies
~/go/src/github.com/golang-starters/golang-rest-http ~
~
~/go/src/github.com/golang-starters/golang-rest-http ~
Building
mv: target '/opt/app-root/gobinary' is not a directory
Build failed
ERROR: An error occurred: non-zero (13) exit code from go-toolset-custom
The repository https://hub.docker.com/r/centos/go-toolset-7-centos7/ has only one image which contains Go 1.10. It should have all the supported versions of Go.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.