postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Docker build instructions outdated

Open kjcsb1 opened this issue 2 years ago • 12 comments

The Docker build instructions on the wiki are out-of-date now that 15 is released.

Is it as simple as running docker build --tag custom-postgres:latest .?

That didn't work for me. I get an 80MB Docker image with only the extensions included, no Postgres.

Any suggestions appreciated.

kjcsb1 avatar Mar 10 '23 05:03 kjcsb1

I still think you need to build through Ansible; check how the Dockerfile assumes certain args

jbergstroem avatar Mar 11 '23 15:03 jbergstroem

+1 on this.

allquantor avatar Apr 02 '23 12:04 allquantor

Can someone help me understand why you'd want to user Docker for the database? Isn't that quite risky? In that when docker restarts, all your data is gone

rienheuver avatar May 17 '23 14:05 rienheuver

Can someone help me understand why you'd want to user Docker for the database? Isn't that quite risky? In that when docker restarts, all your data is gone

You would mount a persistent volume into the running instance of your container, making storage permanent;

$ docker volume create db
$ docker run -v db:/var/lib/postgresql ...

jbergstroem avatar May 17 '23 15:05 jbergstroem

Right, that does make a lot more sense. Is there any documentation on how to do that? And if so, couldn't you do this using the regular Docker compose of supabase?

rienheuver avatar May 17 '23 15:05 rienheuver

Right, that does make a lot more sense. Is there any documentation on how to do that?

And if so, couldn't you do this using the regular Docker compose of supabase?

It already is!

https://github.com/supabase/supabase/blob/677a2288865d8d22f0ccedd575839d2da89ff377/docker/docker-compose.yml#L291-L298

jbergstroem avatar May 17 '23 16:05 jbergstroem

Then why'd you need to decouple your database? Or am I overlooking something now?

rienheuver avatar May 17 '23 16:05 rienheuver

Then why'd you need to decouple your database? Or am I overlooking something now?

Yeah, I'm not quite sure what you are after here. This issue is about the open source bits and bobs of Supabase; how to build things yourself, perhaps hack on them or run the stack yourself be it locally or deploy it into your own ecosystem. How you want to deploy and run postgres is up to you and Supabase is kind enough to share documentation on how to achieve it (note: I do not work there)!

Here is for instance a recent project that shows you how you can deploy supabase on fly.io: https://github.com/nicholasoxford/SupaFly

jbergstroem avatar May 17 '23 16:05 jbergstroem

I want to run the supabase Docker containers with a persisted database. I figured that the database would be wiped when you reboot the containers, since supabase advises to decouple them. If that's not the case I'm good to go I guess. Though I do wonder why they advise to decouple it then

rienheuver avatar May 17 '23 16:05 rienheuver

I'm putting a bounty of $150 over PayPal, donation to a non-political/non-religious charity, or to an OSS project of your choice; I need to build Supabase with TimescaleDB's community license and cannot make sense of the CI/CD here.

If I figure it out before anybody else, I'll post back here.

michaelcooke avatar May 19 '23 02:05 michaelcooke

Bounty expired. I was able to build the image by removing the final stage of the Dockerfile (Remove all lines after HEALTHCHECK ...)

michaelcooke avatar May 19 '23 15:05 michaelcooke

Bounty expired. I was able to build the image by removing the final stage of the Dockerfile (Remove all lines after HEALTHCHECK ...)

No need to delete anything. You can specify the build stage to docker via --target flag. For eg.

docker build . --target production -t supabase/postgres:latest

sweatybridge avatar May 23 '23 06:05 sweatybridge

We have recently revamped our docker build and are in the process of documenting all the changes.

In the short term you can build the docker image locally like this:

create a file .env-local with contents

POSTGRES_PASSWORD=postgres
POSTGRES_HOST=/var/run/postgresql
POSTGRES_INITDB_ARGS=--lc-ctype=C.UTF-8

then run

docker run --name "supabase-postgres" --env-file .env-local -p 5432:5432 sbp-15-6

better docs to follow

olirice avatar Aug 08 '24 18:08 olirice