From ed1d4d1ca9772774fe0e25cbce876fa90c186088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BENEDEK=20L=C3=A1szl=C3=B3?= Date: Thu, 10 Oct 2024 17:34:48 +0200 Subject: [PATCH] basic template --- .gitignore | 2 ++ Dockerfile | 13 +++++++++++++ default.conf.template | 19 +++++++++++++++++++ docker-compose.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ go.mod | 3 +++ main.go | 5 +++++ static/404.html | 1 + static/index.html | 11 +++++++++++ 8 files changed, 96 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 default.conf.template create mode 100644 docker-compose.yml create mode 100644 go.mod create mode 100644 main.go create mode 100644 static/404.html create mode 100644 static/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8cd0df3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +.idea \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de8b9a0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.23 AS build + +COPY . /build +WORKDIR /build + +RUN CGO_ENABLED=0 go build -o /build/app + +FROM scratch +COPY --from=build /build/app /app + +EXPOSE 5000 + +ENTRYPOINT [ "/app" ] \ No newline at end of file diff --git a/default.conf.template b/default.conf.template new file mode 100644 index 0000000..3bd28db --- /dev/null +++ b/default.conf.template @@ -0,0 +1,19 @@ +server { + listen ${NGINX_PORT}; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 404 /404.html; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + location ~ api\/?.* { + proxy_pass http://backend:5000; + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ddb4798 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,42 @@ +services: + db: + image: postgres:17-bookworm + ports: + - 5432:5432 + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: admin + POSTGRES_DB: szoe + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - pgdata:/var/lib/postgresql/data + + adminer: + image: adminer + ports: + - 8080:8080 + depends_on: + - db + + nginx: + image: nginx:1.27-alpine-slim + ports: + - 80:80 + environment: + NGINX_PORT: 80 + volumes: + - ./default.conf.template:/etc/nginx/templates/default.conf.template:ro + - ./static:/usr/share/nginx/html:ro + + backend: + image: dowerx/szoe + build: + context: . + dockerfile: Dockerfile + tags: + - dowerx/szoe + depends_on: + - db + +volumes: + pgdata: \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8b16de0 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.tek.govt.hu/dowerx/szoe-pontok + +go 1.23.0 diff --git a/main.go b/main.go new file mode 100644 index 0000000..7905807 --- /dev/null +++ b/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} diff --git a/static/404.html b/static/404.html new file mode 100644 index 0000000..74b95f3 --- /dev/null +++ b/static/404.html @@ -0,0 +1 @@ +

404 :c

\ No newline at end of file diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..e055dad --- /dev/null +++ b/static/index.html @@ -0,0 +1,11 @@ + + + + + + SZOE pontok + + +

SZOE pontok

+ + \ No newline at end of file