Skip to content

Commit a5f0040

Browse files
CoderYellowclaude
andcommitted
Add Dockerfile and GitHub workflow to build and publish image to GHCR
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 2dbbd0b commit a5f0040

4 files changed

Lines changed: 100 additions & 0 deletions

File tree

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.git
2+
.idea
3+
node_modules
4+
target
5+
data
6+
ebs
7+
doc
8+
resources/static/crux-ui/compiled
9+
resources/static/crux-ui/test
10+
crux-console-conf.edn
11+
*.log

.github/workflows/docker.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Release Docker Image
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['v*']
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to GHCR
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract image metadata
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=ref,event=branch
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=sha
43+
type=raw,value=latest,enable={{is_default_branch}}
44+
45+
- name: Build and push
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ ebs/ebs-upload.zip
2323
!.elasticbeanstalk/*.cfg.yml
2424
!.elasticbeanstalk/*.global.yml
2525
/.idea/
26+
.lein-repl-history

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Build stage: compiles the ClojureScript frontend and packs the uberjar
2+
FROM clojure:temurin-17-lein AS build
3+
4+
RUN apt-get update \
5+
&& apt-get install -y --no-install-recommends nodejs npm \
6+
&& npm install -g yarn \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /build
10+
11+
# fetch deps first so they cache independently of source changes
12+
COPY package.json yarn.lock ./
13+
RUN yarn install --frozen-lockfile
14+
COPY project.clj shadow-cljs.edn ./
15+
RUN lein with-profile base:crux-jars deps
16+
17+
COPY . .
18+
RUN node_modules/.bin/shadow-cljs release app \
19+
&& lein with-profile base:crux-jars uberjar
20+
21+
# Runtime stage
22+
FROM eclipse-temurin:17-jre
23+
24+
WORKDIR /app
25+
COPY --from=build /build/target/crux-console.jar ./crux-console.jar
26+
27+
# 5000 = console frontend, 8080 = embedded Crux HTTP API
28+
# (the browser talks to 8080 directly, so publish both)
29+
EXPOSE 5000 8080
30+
31+
# embedded Crux (RocksDB) persists here
32+
VOLUME /app/data
33+
34+
ENTRYPOINT ["java", "-jar", "crux-console.jar"]
35+
CMD ["--embed-crux", "true", "--crux-node-url-base", "\"localhost:8080\""]

0 commit comments

Comments
 (0)