Git Product home page Git Product logo

golang-example's Introduction

golang-example

This project enable you to build golang application

Inspired by

Golang Docker Official Images

Use multi-stage builds with Golang

A OpenID / Keycloak Proxy service written in golang

Official Golang website: The Go Programming Language

Create the smallest and secured golang docker image based on scratch

Package build

This project get soure code from

Possible direction

Branch

  • keycloak-gatekeeper
  • go-kit (Failed, do not use)
  • gin-and-gorm-rest-api (based on project )
    • Using tableplus, GUI and SQLite3
    • Using sqlite3
    • import mod from local path
    • using go lang viper and godotenv and go env var from medium
    • Need to remove the volume by docker volume ls and docker volume rm <uuid>
    • The Gorm seem faulty, need to add the key words: sslmode:disable, see more info
    • Great help from here
    • Start project
      • go mod init
      • go mod vendor
      • go run main.go
    • Deploy into Kubernetes
    • Using go mod download to speed up Golang Docker builds
    • Using Power environment
      • docker network create golang-example
      • docker run -d -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=example --name postgres --network golang-example --mount source=prosgret-vol,destination=/var/lib/postgresql/data -p 5432:5432 postgres:latest
      • docker run -d -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=example -e POSTGRES_DB=postgres -e POSTGRES_HOST=postgres -e POSTGRES_PORT=5432 --network golang-example --name golang-example -p 8080:8080 moxing9876/golang-example:0.0.3
        • example output
        CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS              PORTS                    NAMES
        9168b3afde13        moxing9876/golang-example:0.0.3   "/go/bin/hello"          4 seconds ago       Up 3 seconds        0.0.0.0:8080->8080/tcp   golang-example
        6949a79586fb        postgres:latest                   "docker-entrypoint.sā€¦"   6 minutes ago       Up 6 minutes        0.0.0.0:5432->5432/tcp   postgres
        
      • $ curl http://localhost:8080/books
        • example output :
        {"data":[{"id":1,"title":"title1","author":"author1"},{"id":2,"title":"title1","author":"author1"}]}
        

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.