Skip to content

changed port #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
20 changes: 20 additions & 0 deletions Deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: app/v1
kind: Deployment
metadata:
name: my-deployment
labels:
app: golang
spec:
selector:
matchLabels:
app: myapp
replicas: 4
template:
metadata:
name: golang-2
labels:
app: myapp
spec:
containers:
- name: golang
image: sharvis8/simplegolang:latest
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:latest

RUN mkdir /app

COPY . /app

WORKDIR /app

CMD go run main.go
46 changes: 46 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
pipeline {
agent any
stages {
stage('checkout') {
steps {
git(url: 'https://github.com/sharvis8/simple-webserver-golang', branch: 'main')
}
}

stage('Listing files') {
steps {
sh 'ls -la'
}
}

stage('new empty file') {
steps {
sh 'touch emptyFile'
}
}

stage('DockerBuild') {
steps {
sh 'docker build -t simplegolang . -t sharvis8/simplegolang:latest'
}
}

stage('DockerLogin') {
environment {
DOCKERHUB_USER = 'sharvis8'
DOCKERHUB_PASSWORD = 'Vantage@#456'
}
steps {
sh 'docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD'
}
}

stage('Dockerhub Push') {
steps {
sh 'docker push sharvis8/simplegolang:latest'
}
}


}
}
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func main() {
http.HandleFunc("/form", formHandler)
http.HandleFunc("/hello", helloHandler)

fmt.Printf("Starting server at port 8080\n")
fmt.Printf("Starting server at port 8090\n")

if err := http.ListenAndServe(":8080", nil); err != nil {
if err := http.ListenAndServe(":8090", nil); err != nil {
log.Fatal(err)
}
}