Optimize buildx with layer cache
This commit is contained in:
parent
70b30a4806
commit
3d7088a6bf
4 changed files with 37 additions and 47 deletions
|
|
@ -9,6 +9,8 @@ node_modules
|
|||
.prettierrc
|
||||
.pretieriignore
|
||||
.env
|
||||
.svelte-kit
|
||||
build
|
||||
README.md
|
||||
Dockerfile
|
||||
docker-compose.yaml
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
# docker build . -t docker.frappet.com/demo/qualifying-exam-cms:latest
|
||||
FROM node:18 as build
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN npm ci
|
||||
# optimize build speed by copy all .xx folder and
|
||||
COPY *.json .
|
||||
COPY *.*s .
|
||||
RUN npm i
|
||||
COPY src ./src
|
||||
RUN ls
|
||||
RUN npm run build
|
||||
FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
import { derived, writable } from 'svelte/store'
|
||||
|
||||
export function createUrlStore(ssrUrl) {
|
||||
// Ideally a bundler constant so that it's tree-shakable
|
||||
if (typeof window === 'undefined') {
|
||||
const { subscribe } = writable(ssrUrl)
|
||||
return { subscribe }
|
||||
}
|
||||
|
||||
const href = writable(window.location.href)
|
||||
|
||||
const originalPushState = history.pushState
|
||||
const originalReplaceState = history.replaceState
|
||||
|
||||
const updateHref = () => href.set(window.location.href)
|
||||
|
||||
history.pushState = function () {
|
||||
originalPushState.apply(this, arguments)
|
||||
updateHref()
|
||||
}
|
||||
|
||||
history.replaceState = function () {
|
||||
originalReplaceState.apply(this, arguments)
|
||||
updateHref()
|
||||
}
|
||||
|
||||
window.addEventListener('popstate', updateHref)
|
||||
window.addEventListener('hashchange', updateHref)
|
||||
|
||||
return {
|
||||
subscribe: derived(href, ($href) => new URL($href)).subscribe
|
||||
}
|
||||
}
|
||||
|
||||
// If you're using in a pure SPA, you can return a store directly and share it everywhere
|
||||
export default createUrlStore()
|
||||
Loading…
Add table
Add a link
Reference in a new issue