Skip to content

Commit

Permalink
added client and bake it into the docker container (not yet tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timtam committed Mar 9, 2024
1 parent 51edfa9 commit 0a987f3
Show file tree
Hide file tree
Showing 17 changed files with 3,282 additions and 10 deletions.
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
FROM rust:1.76-slim-bookworm as build
FROM node:20 AS CLIENT_BUILD_IMAGE

WORKDIR /app

COPY ./client /app

RUN npm install && npm run build

FROM rust:1.76-slim-bookworm as SERVER_CLIENT_IMAGE

# create a new empty shell project
RUN apt-get update && apt-get -y install libssl-dev pkg-config && \
Expand All @@ -25,6 +33,8 @@ RUN cargo build --release
# our final base
FROM debian:bookworm-slim

WORKDIR /hitster

# prepare the OS

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
Expand All @@ -33,7 +43,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
rm -rf /var/lib/apt/lists/*

# copy the build artifact from the build stage
COPY --from=build /hitster/target/release/hitster-server ./hitster
COPY --from=SERVER_BUILD_IMAGE /hitster/target/release/hitster-server /hitster/server/hitster
COPY --from=CLIENT_BUILD_IMAGE /app/dist /hitster/client/dist

# set the startup command to run your binary
CMD ["./hitster"]
CMD ["/hitster/server/hitster"]
18 changes: 18 additions & 0 deletions client/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 4 additions & 0 deletions client/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 4,
"semi": false
}
13 changes: 13 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit 0a987f3

Please sign in to comment.