diff options
Diffstat (limited to 'docker/api')
-rw-r--r-- | docker/api/Dockerfile | 22 | ||||
-rw-r--r-- | docker/api/docker-compose.yml | 35 |
2 files changed, 57 insertions, 0 deletions
diff --git a/docker/api/Dockerfile b/docker/api/Dockerfile new file mode 100644 index 0000000..c92d35a --- /dev/null +++ b/docker/api/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:alpine AS builder + +RUN apk --update add ca-certificates git + +WORKDIR /app + +COPY . . +RUN go mod download + +RUN CGO_ENABLED=0 GOOS=linux go build cmd/api/main.go + +# Run the exe file +FROM scratch + +WORKDIR /app + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /app . + +EXPOSE 8080 + +CMD ["./main"] diff --git a/docker/api/docker-compose.yml b/docker/api/docker-compose.yml new file mode 100644 index 0000000..53c105f --- /dev/null +++ b/docker/api/docker-compose.yml @@ -0,0 +1,35 @@ +services: + postgres: + image: postgres:16-alpine + container_name: rahanna-postgres + restart: always + environment: + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + networks: + - default + volumes: + - postgres_data:/var/lib/postgresql/data + + rahanna: + image: rahanna-api + container_name: rahanna-api + networks: + - default + environment: + - DATABASE_URL=${DATABASE_URL} + - JWT_TOKEN=${JWT_TOKEN} + - API_ADDRESS=:8080 + - DEBUG=0 + depends_on: + - postgres + ports: + - "8080:8080" + restart: unless-stopped + +networks: + default: + +volumes: + postgres_data: |