![]() I use this setup all the time, and it’s great! However there are a couple of areas where we could improve it: Run a docker-compose up command when you’re ready to debug.Create a docker-compose.yml file with your dependcies.And to be honest, there is absolutely nothing wrong with this setup: Honestly, we could stop at this point! We have a Compose file that spins up our dependcies, we can start debugging and hit our database just fine. Postman call to our Users controller, returning the first user in the database At this point we can run a docker-compose up to get our database running: I can’t say enough nice things about it, but we won’t be covering it here.įor the PostgreSQL container we simply pull an 11.6 Alpine version, mount our SQL files from the Fixtures folder to the docker-entrypoint-initdb.b folder and we’re off. If you’re not familiar with Dozzle, go here and check it out. We spin up two containers, the PostreSQL database and a Dozzle container. Sticking with the “keeping it simple” trend, there isn’t much going on in this file. Fixtures/sql/:/docker-entrypoint-initdb.d/ ports: - "5432:5432" dozzle: container_name: api_dozzle image: amir20/dozzle:latest volumes: - /var/run/docker.sock:/var/run/docker.sock ports: - "8888:8080" Next, let’s take a peek at the docker-compose.yml file which will spin up the dependencies we need for our API, in this case a PostgreSQL database: version: "3.7" services: database: container_name: api_postgres image: postgres:11.6-alpine environment: POSTGRES_DB: api_postgres volumes:. NET and Docker files so we won’t go too deep on those.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |