Skip to content
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

Frontend Docker Image #2

Merged
merged 8 commits into from
Aug 17, 2024
Merged

Frontend Docker Image #2

merged 8 commits into from
Aug 17, 2024

Conversation

jb3
Copy link
Member

@jb3 jb3 commented Aug 17, 2024

Add a Docker image for running the development version of the frontend locally.

This spins up the Vite development server in a Docker container allowing for live-reloading with changes in the thallium-frontend directory.

Since we don't deploy the application with Docker, this is not an optimised image and runs with the development server (rather than some sort of static file hosting software with the built image).

If desired, it should still be possible to have the container eject a built version by running it with pnpm run build, though this may be missing things such as git context which cannot be detected (we do not mount the .git folder in the root, only the subdirectory).

Copy link

netlify bot commented Aug 17, 2024

Deploy Preview for thallium canceled.

Name Link
🔨 Latest commit 270aa07
🔍 Latest deploy log https://app.netlify.com/sites/thallium/deploys/66c0ac2154040c000891e513

@jb3
Copy link
Member Author

jb3 commented Aug 17, 2024

/merge

Copy link

pydis-ff-bot bot commented Aug 17, 2024

✅ Successfully fast-forwarded commits from owl-corp:jb3/frontend/docker-image onto main

@pydis-ff-bot pydis-ff-bot bot merged commit 270aa07 into main Aug 17, 2024
10 checks passed
@pydis-ff-bot pydis-ff-bot bot deleted the jb3/frontend/docker-image branch August 17, 2024 13:58
Comment on lines +7 to +13
try {
commitHash = child.execSync("git rev-parse --short HEAD")
.toString().replace(/\n$/, "");
} catch (e) {
console.error("Failed to get commit hash");
console.error(e);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, you can read .git/HEAD and then open the file linked in ref: $FILENAME to get the current commit hash without git.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have git, the problem is we build in the context of the thallium-frontend subdirectory of the monorepo, whilst the .git folder sits in the monorepo root, so we just do not have the .git folder in the build at all.

We can add handling down the line to read this value out of the git_sha build argument that we get passed in and do something like "test against git, try fetch git_sha arg, default to 'unknown'".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants