Properly do staging
This commit is contained in:
parent
b78e015a95
commit
0e9e8c6085
|
@ -4,6 +4,7 @@
|
|||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"staging": "vite build --mode staging",
|
||||
"package": "svelte-kit package",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync",
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { sha256 } from 'js-sha256';
|
||||
import GuestbookEntry from './guestbook/guestbook-entry.svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { comment } from 'postcss';
|
||||
import { mode } from '$app/env';
|
||||
|
||||
//const ApiURL = dev ? 'https://api.quenten.nl/api/testing' : 'https://api.quenten.nl/api';
|
||||
//const ApiURL = import.meta.env.APIURL;
|
||||
const ApiURL = mode == 'production' ? 'https://api.quenten.nl/api' : 'https://api.quenten.nl/api/testing';
|
||||
let showError = false;
|
||||
let errorTitle = 'Error';
|
||||
let errorMessage = 'Error message';
|
||||
|
@ -58,7 +60,7 @@ import { comment } from 'postcss';
|
|||
};
|
||||
|
||||
const jsonData = JSON.stringify(data);
|
||||
const res = await fetch('https://api.quenten.nl/api/testing/comment', {
|
||||
const res = await fetch(ApiURL + '/comment', {
|
||||
method: 'POST',
|
||||
body: jsonData
|
||||
});
|
||||
|
@ -91,7 +93,7 @@ import { comment } from 'postcss';
|
|||
return;
|
||||
}
|
||||
|
||||
let newHash = await fetch('https://api.quenten.nl/api/testing/commenthash')
|
||||
let newHash = await fetch(ApiURL + '/commenthash')
|
||||
.then((res) => res.text())
|
||||
.then((t) => {
|
||||
return t;
|
||||
|
@ -107,7 +109,7 @@ import { comment } from 'postcss';
|
|||
|
||||
async function fetchComments() {
|
||||
let comments: Comment[];
|
||||
comments = await fetch('https://api.quenten.nl/api/testing/comment')
|
||||
comments = await fetch(ApiURL + '/comment')
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
return data;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
FROM node:18.2.0-alpine
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN npm ci
|
||||
RUN npm audit fix
|
||||
RUN npm run staging
|
||||
|
||||
FROM node:18.2.0-alpine
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=0 /app/package*.json ./
|
||||
RUN npm ci --ignore-scripts
|
||||
RUN npm audit fix
|
||||
COPY --from=0 /app/build ./
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["node", "./index.js"]
|
|
@ -2,7 +2,7 @@ import { sveltekit } from '@sveltejs/kit/vite';
|
|||
|
||||
/** @type {import('vite').UserConfig} */
|
||||
const config = {
|
||||
plugins: [sveltekit()]
|
||||
plugins: [sveltekit()],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
|
Loading…
Reference in New Issue