add
This commit is contained in:
19
trading_assistant_api/services/country/Dockerfile
Normal file
19
trading_assistant_api/services/country/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM golang:1.25.7-alpine3.23 AS builder
|
||||
WORKDIR /workspace
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# copy monorepo workspace and modules needed for country service
|
||||
COPY go.work .
|
||||
COPY common ./common
|
||||
COPY services/country ./services/country
|
||||
|
||||
# download deps and build binary
|
||||
RUN cd services/country && go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /workspace/bin/country-service ./services/country
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN adduser -D -u 10002 app
|
||||
USER app
|
||||
COPY --from=builder /workspace/bin/country-service /usr/local/bin/country-service
|
||||
EXPOSE 8081
|
||||
ENTRYPOINT ["/usr/local/bin/country-service"]
|
||||
59
trading_assistant_api/services/docker-compose.yml
Normal file
59
trading_assistant_api/services/docker-compose.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18.1-alpine
|
||||
container_name: user_postgres
|
||||
environment:
|
||||
POSTGRES_USER: app
|
||||
POSTGRES_PASSWORD: app123
|
||||
POSTGRES_DB: appdb
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U app -d appdb"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
- ../services/user/db/schema.sql:/docker-entrypoint-initdb.d/10_user_schema.sql:ro
|
||||
|
||||
user:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/user/Dockerfile
|
||||
image: user-service:latest
|
||||
container_name: user_service
|
||||
environment:
|
||||
PG_HOST: postgres
|
||||
PG_PORT: "5432"
|
||||
PG_USER: app
|
||||
PG_PASSWORD: app123
|
||||
PG_DBNAME: appdb
|
||||
PG_SSLMODE: disable
|
||||
MIGRATE_ON_START: "0"
|
||||
PORT: "8080"
|
||||
JWT_SECRET: "change_me_dev_secret"
|
||||
JWT_TTL: "24h"
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
country:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/country/Dockerfile
|
||||
image: country-service:latest
|
||||
container_name: country_service
|
||||
environment:
|
||||
PORT: "8081"
|
||||
ports:
|
||||
- "8081:8081"
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
ROOT_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
docker build -f services/user/Dockerfile -t user-service:latest .
|
||||
docker save user-service:latest -o services/user/user-service.tar
|
||||
docker load -i services/user/user-service.tar
|
||||
cd services/user
|
||||
docker compose up -d
|
||||
Reference in New Issue
Block a user