mirror of
https://github.com/zoriya/vex.git
synced 2025-12-06 07:06:09 +00:00
Add docker and compose
This commit is contained in:
9
.env.example
Normal file
9
.env.example
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# vi: ft=sh
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
|
# Database things
|
||||||
|
POSTGRES_USER=vex
|
||||||
|
POSTGRES_PASSWORD=pass
|
||||||
|
POSTGRES_DB=vex_db
|
||||||
|
POSTGRES_SERVER=postgres
|
||||||
|
POSTGRES_PORT=5432
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
9
api/Dockerfile
Normal file
9
api/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM golang:1.22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN go build -o ./vex
|
||||||
|
|
||||||
|
EXPOSE 1597
|
||||||
|
CMD ./vex
|
||||||
6
api/Dockerfile.dev
Normal file
6
api/Dockerfile.dev
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FROM golang:1.22-alpine
|
||||||
|
RUN go install github.com/bokwoon95/wgo@latest
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
EXPOSE 1597
|
||||||
|
CMD wgo run .
|
||||||
29
docker-compose.dev.yml
Normal file
29
docker-compose.dev.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
services:
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: ./api
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
restart: on-failure
|
||||||
|
volumes:
|
||||||
|
- ./api:/app
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
restart: on-failure
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
services:
|
||||||
|
api:
|
||||||
|
build: ./api
|
||||||
|
restart: on-failure
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
restart: on-failure
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
Reference in New Issue
Block a user