This file contains hidden or 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
# main.go | |
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" |
This file contains hidden or 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
DOCKER_COMPOSE_BIN = docker-compose | |
DOCKER_COMPOSE = $(DOCKER_COMPOSE_BIN) | |
GO_BIN = go | |
GO = $(GO_BIN) | |
APP = docker exec -ti $$(docker-compose ps -q app) | |
all: start |
This file contains hidden or 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
version: "3.5" | |
services: | |
app: | |
image: vhoen/go-base:latest | |
container_name: go-weather-temperature | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.go-weather-temperature.entrypoints=web" | |
- "traefik.http.routers.go-weather-temperature.rule=Host(`weather.localhost`) && PathPrefix(`/go-weather-temperature`)" | |
- "traefik.http.routers.go-weather-temperature.service=go-weather-temperature" |
This file contains hidden or 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
% go mod init forecast/v1 | |
% go mod tidy | |
% go run main.go |
This file contains hidden or 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
#go-weather-forecast | |
package main | |
import ( | |
"context" | |
"encoding/json" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" |
This file contains hidden or 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
# syntax=docker/dockerfile:1 | |
FROM centos:latest | |
# Mise à jour et installation de git | |
RUN yum -qy update && yum clean all | |
RUN yum -qy install git | |
# Installation de golang | |
RUN wget https://golang.org/dl/go1.17.3.linux-amd64.tar.gz | |
RUN tar -xzf go1.17.3.linux-amd64.tar.gz |
This file contains hidden or 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
version: "3.5" | |
services: | |
logs: | |
image: vhoen/go-base:1.0 | |
container_name: go-app-1 | |
volumes: | |
- .:/go/src/go-onsite-app | |
ports: | |
- "8000:8000" |
This file contains hidden or 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
# main.go | |
package main | |
import ( | |
"context" | |
"encoding/json" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" |
This file contains hidden or 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
# Récupération de l'image | |
docker pull vhoen/go-base:1.0 | |
# Lancement du microservice | |
docker run -p 8000:8000 vhoen/go-base:1.0 |
This file contains hidden or 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
# Authentification docker | |
docker login | |
# Tag de l'image | |
docker tag go-base:1.0 vhoen/go-base:1.0 | |
# Push de l'image | |
docker push vhoen/go-base:1.0 |
NewerOlder