bldg14 / eventual

A simple event calendar
https://eventual-client.fly.dev
MIT License
0 stars 0 forks source link

Kf/46 define backend url build arg in stage its used #47

Closed kevinfalting closed 10 months ago

kevinfalting commented 10 months ago

Overview

The main problem was the the client was not able to make requests to the server, the two of which are hosted on separate domains. The request was being made, but it was to the origin as opposed to the server's url. The expectation is that the build step would inject the value provided in the REACT_APP_BACKEND_URL environment variable available at build time in the container, however the build arg that defines the default value was not in the same scope as where the build step was, so it was interpreting it as an empty string.

Related Issues / PRs

46

Thought Process

Took a bit of debugging, but finally found the issue. According to the docs:

An ARG instruction goes out of scope at the end of the build stage where it was defined.

I moved the BACKEND_URL build arg into the builder step, and it worked.

Testing Steps

docker build -t eventual-client -f Dockerfile.client .

Expect it to build successfully.

Risks

I've pushed this up to production already and everything builds. There was a hiccup with my other computer where I couldn't get the image to build, but that seems to be isolated to that computer's environment.