Grafana, Nginx and docker results in a 502

Hi there. I am trying to deploy grafana through a docker-compose.yml file

...
  grafana:
    image: grafana/grafana
    depends_on:
      - prometheus 
    ports:
      - "3000:3000"
    env_file:
      - .env
    volumes:
      - grafana_data:/var/lib/grafana
    networks:
      - main 
...

.env

...
GF_SERVER_ROOT_URL='grafana.somedaomain.xyz'
...

And this is how my nginx config looks like

server {
  listen 8080;
	server_name grafana.*;

  root /usr/share/nginx/html;
  index index.html index.htm;

	location / {
		proxy_pass grafana:3000;
		proxy_max_temp_file_size 0; 
}

However I cannot access it through my domain, I tried to test it locally by adding a new entry in my /etc/hosts but nginx just gives me a 502 Bad Gateway and localhost:3000 results in the following message from grafana.

I’m not entirely sure how this should be fixed though.