-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build another docker image that uses the .env.staging file instead of .env.production and tag it with "staging" #36
Conversation
…d of .env.production and tag it with "dev"
.github/workflows/docker.yml
Outdated
- id: meta-dev | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/projectlighthousecau/luna | ||
tags: | | ||
type=raw,value=dev,enable={{is_default_branch}} | ||
type=sha,format=long | ||
- name: Build and Push dev image | ||
uses: docker/build-push-action@v5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of running these sequentially, I'd suggest running them either as parallel jobs, maybe via different matrix configurations. This would avoid a fair bit of duplication here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that there might be a way to avoid code duplication, but I didn't know how, so I simply duplicated it.
Feel free to refactor 😄
Docker build takes too long, I cancelled it after 6 minutes. On my laptop it took ~24 minutes. |
Docker CI on the main branch takes 2 minutes: https://github.com/ProjectLighthouseCAU/luna/actions/runs/10551448727/job/29228906391 So it really shouldn't take that long. Not sure why that happens for you locally, in CI my only guess would be that the aarch64 build is slow under emulation, but with the |
That must have been the problem, now the CI runs fast enough (could be sped up with parallel execution though). |
… HashRouter for serving the app under a sub-path on the server
Not sure if this worked in the first place
Thanks! |
This is definitely a hacky little solution but it might work for simply building a second docker image with the .env.development file instead of the default .env.production file that is used when building the website.
How it "works" (we'll see if it works, when the action runs successfully):
In GitHub Actions I added a copy of the metadata and build-and-push action steps where an environment variable with the value "dev" is passed as a docker build-arg to the Dockerfile. The Dockerfile then appends this environment variable to
npm run build
which then becomesnpm run builddev
which conveniently is a script in package.json that uses theenv-cmd
tool to runcraco build
with the .env.development file.