generated from FiV0/clj-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4257436
commit b15f492
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: Build & Push Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
GH_REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-and-push-github: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'xtdb/xt-fiddle' | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.GH_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.GH_REGISTRY }}/${{ github.repository }} | ||
tags: | | ||
type=sha,format=short | ||
type=sha,format=long | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM clojure:temurin-21-tools-deps-alpine AS frontend-build | ||
WORKDIR /app | ||
|
||
# Install build deps | ||
RUN apk add --update nodejs npm yarn | ||
|
||
# Install node deps | ||
COPY package.json .yarnrc.yml yarn.lock . | ||
RUN yarn install | ||
|
||
# Install clojure build deps | ||
COPY deps.edn . | ||
RUN clojure -P -M:cljs:dev | ||
|
||
# Build the frontend | ||
# TODO: Copy over only cljs files? | ||
COPY . . | ||
RUN npx shadow-cljs release app | ||
|
||
|
||
FROM clojure:temurin-21-tools-deps-alpine | ||
WORKDIR /app | ||
|
||
# Install the runtime deps | ||
COPY deps.edn . | ||
RUN clojure -P | ||
|
||
# Add the source & frontend code | ||
COPY --from=frontend-build /app/resources/public/js/compiled /app/resources/public/js/compiled | ||
# TODO: Copy over only clj files? | ||
COPY . . | ||
CMD clojure -X:prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters