Init commit

pull/6/head
yuobrezkov 2025-03-11 11:44:46 +03:00
parent ab8b19c1e9
commit d9f86158af
11 changed files with 93 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
README.md
Jenkinsfile
Dockerfile
.gitignore
.idea

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="INFORMATION" enabled_by_default="true">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/test-ci-cd.iml" filepath="$PROJECT_DIR$/.idea/test-ci-cd.iml" />
</modules>
</component>
</project>

9
.idea/test-ci-cd.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM golang:1.23.6 AS builder
WORKDIR /app
COPY go.mod .
RUN go mod tidy
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server main.go
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/server /app/server
RUN chmod +x /app/server
ENTRYPOINT ["/app/server"]

0
Jenkinsfile vendored Normal file
View File

View File

@ -1,2 +1,5 @@
# test-ci-cd # test-ci-cd
```bash
docker build -t test-ci-cd .
docker run --rm --name test-ci-cd -p 8000:8080 test-ci-cd:latest

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module main
go 1.23.2

20
main.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
http.HandleFunc("/", handler)
port := ":8080"
fmt.Println("Сервер запущен на порту", port)
if err := http.ListenAndServe(port, nil); err != nil {
fmt.Println("Ошибка запуска сервера:", err)
}
}