gobuffalo/buffalo

Cannot use Soda CLI with Docker Compose

burakkarasel opened this issue · 1 comments

First of all I'm a newbie with docker it might be because of me. I have two containers and built a docker compose file for it. Everything goes smooth my go application gets built, i can install soda but i can't run soda migrate i receive an error says soda not found.

My docker file looks like this

`# Build Stage
FROM golang:1.19-alpine3.16 AS builder
WORKDIR /app
COPY . .
RUN go install github.com/gobuffalo/pop/v6/soda@latest
RUN go build -o main cmd/main/main.go

Run stage

FROM alpine:3.16
WORKDIR /app
COPY --from=builder /app/main .
COPY app.env .
COPY database.yml .
COPY start.sh .
COPY wait-for.sh .
COPY db/migrations ./migrations

EXPOSE 8080
CMD [ "/app/main" ]
ENTRYPOINT [ "/app/start.sh" ]`

and my docker compose file looks like this

services: postgres: image: postgres:12-alpine environment: - POSTGRES_USER= - POSTGRES_PASSWORD= - POSTGRES_DB=bank_app api: build: context: . dockerfile: Dockerfile ports: - "8080:8080" environment: - DB_SOURCE=postgresql://root:password@postgres:5432/bank_app?sslmode=disable depends_on: - postgres entrypoint: ["/app/wait-for.sh", "postgres:5432", "--", "/app/start.sh"] command: ["/app/main"]

and start.sh shell script looks like this
`#!/bin/sh

set -e

echo "run db migration"
which soda && soda migrate up

echo "start the app"
exec "$@"`

Am i missing out something ? I have a lot of things but cant solve it. Installation completes succesfully but i can't use the command i don't know why. Open to any suggestions!

Didnt check preview my bad it's a little messy