Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,28 @@ RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy source code
# Copy all source code, including the pre-built frontend and entrypoint script
COPY . .

# Build the application with optimizations
RUN cargo build --release --bin embucketd

# Stage 4: Final runtime image
# Stage 2: Final runtime image
FROM gcr.io/distroless/cc-debian12 AS runtime

# Set working directory
USER nonroot:nonroot
WORKDIR /app

# Copy the binary and required files
# Copy the compiled binary, API spec, frontend build, and entrypoint script
COPY --from=builder /app/target/release/embucketd ./embucketd
COPY --from=builder /app/rest-catalog-open-api.yaml ./rest-catalog-open-api.yaml
COPY --from=builder /app/frontend/dist ./dist
COPY --from=builder /app/entrypoint.sh /usr/local/bin/entrypoint.sh

# Make the script executable and ensure the nonroot user can modify app files
RUN chmod +x /usr/local/bin/entrypoint.sh && chown -R nonroot:nonroot /app

# Switch to a non-privileged user
USER nonroot:nonroot

# Expose port (adjust as needed)
EXPOSE 8080
Expand All @@ -37,5 +43,7 @@ ENV FILE_STORAGE_PATH=data/
ENV BUCKET_HOST=0.0.0.0
ENV JWT_SECRET=63f4945d921d599f27ae4fdf5bada3f1

# Default command
# Set the entrypoint to our script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

CMD ["./embucketd"]
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ services:
- 3000:3000
- 8080:8080
environment:
- API_URL=http://localhost:3000
- OBJECT_STORE_BACKEND=s3
- SLATEDB_PREFIX=data/
- AWS_ACCESS_KEY_ID=minioadmin
Expand Down
14 changes: 14 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e

INDEX_FILE=/app/dist/index.html

# Use the provided API_URL or default to http://localhost:3000 if it's not set
FINAL_API_URL=${API_URL:-http://localhost:3000}

echo "Setting API URL to $FINAL_API_URL in $INDEX_FILE"

# Use sed to replace the placeholder with the actual API_URL.
sed -i "s#__API_URL__#$FINAL_API_URL#g" $INDEX_FILE

exec "$@"
2 changes: 1 addition & 1 deletion ui/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Also extend "env.ts" when adding new environment variables
VITE_API_URL=http://localhost:3000
# TEST=http://localhost:3000
Binary file modified ui/dist.tar
Binary file not shown.
5 changes: 3 additions & 2 deletions ui/env.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { defineConfig } from '@julr/vite-plugin-validate-env';
import { z } from 'zod';

// import { z } from 'zod';

export default defineConfig({
validator: 'standard',
schema: {
VITE_API_URL: z.string(),
// TEST: z.string(),
},
});
5 changes: 5 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
<body>
<div id="root"></div>
<script type="module" src="/src/app/main.tsx"></script>
<script>
window.env = {
API_URL: '__API_URL__',
};
</script>
</body>
</html>
6 changes: 1 addition & 5 deletions ui/orval.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { ConfigExternal } from '@orval/core';
import dotenv from 'dotenv';
import { defineConfig } from 'orval';

dotenv.config();

// eslint-disable-next-line n/no-process-env
const apiUrl = process.env.VITE_API_URL!;
const apiUrl = 'http://localhost:3000';

const config = {
embucket: {
Expand Down
23 changes: 11 additions & 12 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"pre-commit": "npx lint-staged"
},
"dependencies": {
"@codemirror/autocomplete": "^6.18.7",
"@codemirror/autocomplete": "^6.19.0",
"@codemirror/commands": "^6.8.1",
"@codemirror/lang-sql": "^6.10.0",
"@codemirror/language": "^6.11.3",
Expand All @@ -47,9 +47,9 @@
"@radix-ui/react-toggle": "^1.1.10",
"@radix-ui/react-tooltip": "^1.2.8",
"@tailwindcss/vite": "^4.1.13",
"@tanstack/react-query": "^5.90.1",
"@tanstack/react-query-devtools": "^5.90.1",
"@tanstack/react-router": "1.131.50",
"@tanstack/react-query": "^5.90.2",
"@tanstack/react-query-devtools": "^5.90.2",
"@tanstack/react-router": "1.132.7",
"@tanstack/react-table": "^8.21.3",
"@tidbcloud/codemirror-extension-cur-sql-gutter": "^0.0.6",
"@tidbcloud/codemirror-extension-events": "^0.0.7",
Expand All @@ -60,20 +60,19 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dayjs": "^1.11.18",
"dotenv": "^17.2.2",
"i18next": "^25.5.2",
"lucide-react": "^0.544.0",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-dropzone": "^14.3.8",
"react-hook-form": "^7.63.0",
"react-i18next": "^15.7.3",
"react-i18next": "^16.0.0",
"react-intersection-observer": "^9.16.0",
"react-resizable-panels": "^3.0.6",
"sonner": "^2.0.7",
"sql-formatter": "^15.6.9",
"tailwind-merge": "^3.3.1",
"tw-animate-css": "^1.3.8",
"tw-animate-css": "^1.4.0",
"use-local-storage": "^3.0.0",
"zod": "^4.1.11",
"zustand": "^5.0.8"
Expand All @@ -84,8 +83,8 @@
"@julr/vite-plugin-validate-env": "^2.2.0",
"@orval/core": "^7.11.2",
"@tanstack/eslint-plugin-query": "^5.90.1",
"@tanstack/router-devtools": "1.131.50",
"@tanstack/router-plugin": "1.131.50",
"@tanstack/router-devtools": "1.132.7",
"@tanstack/router-plugin": "1.132.7",
"@types/node": "24.5.2",
"@types/react": "^19.1.13",
"@types/react-dom": "^19.1.9",
Expand All @@ -95,9 +94,9 @@
"eslint-plugin-n": "^17.23.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "^0.4.21",
"knip": "^5.64.0",
"lint-staged": "^16.2.0",
"eslint-plugin-react-refresh": "^0.4.22",
"knip": "^5.64.1",
"lint-staged": "^16.2.1",
"npm-check-updates": "^18.3.0",
"orval": "^7.11.2",
"prettier": "^3.6.2",
Expand Down
Loading