# How to setup Our Docker Environment for Development ## Prerequisites - Docker ## Setup Database docker container 1. Create a docker network ```bash docker network create goailaim_network ``` 2. Create the database container ```bash sudo docker run --name goalaim_db -d -p 5432:5432 -e POSTGRES_PASSWORD=admin postgres ``` 3. Enable auto start of the container ```bash sudo docker update --restart=always goalaim_db ``` You can test the database connection by running the following command ```bash psql --host=0.0.0.0 -U postgres ``` ## Setup Backend docker container You have two options to setup the backend container. The first option is to build the container from the Dockerfile and the second option is to pull the image from the docker hub. ### Option 1: Build the container from the Dockerfile 1. Build the backend container Go to the root of the folder and run the following command: ```bash sudo docker build -t goalaim_backend . ``` 2. Create the backend container ```bash sudo docker run --name goalaim -p 8080:8080 -e DATABASE_URL=postgres://DB_USER:DB_PASSWORD@DB_CONTAINER_NAME/goalaim_db -e JWT_SECRET="your_secret" -e JWT_DURATION=15 -e STEAM_API_KEY=YOUR_STEAM_API_KEY --network goalaim_network goalaim_backend ``` 3. Enable auto start of the container This step is optional but recommended. ```bash sudo docker update --restart=always goalaim ``` ### Option 2: Pull the image from the docker hub 1. Login to ghcr.io ```bash echo | sudo docker login ghcr.io -u USERNAME --password-stdin ``` 2. Pull the image from the docker hub ```bash docker pull ghcr.io/les-parpaings/goalaim-backend:vX.X.X ``` 3. Create the backend container ```bash sudo docker run --name goalaim -p 8080:8080 -e DATABASE_URL=postgres://DB_USER:DB_PASSWORD@DB_CONTAINER_NAME/goalaim_db -e JWT_SECRET="your_secret" -e JWT_DURATION=15 -e STEAM_API_KEY=YOUR_STEAM_API_KEY --network goalaim_network ghcr.io/les-parpaings/goalaim-backend:vX.X.X ``` 4. Enable auto start of the container This step is optional but recommended. ```bash sudo docker update --restart=always goalaim ```