Skip to content
Snippets Groups Projects
Commit dc0f9c75 authored by Quentin Bramas's avatar Quentin Bramas
Browse files

create prod build instead of dev

parent eb9ac044
Branches
Tags
No related merge requests found
Pipeline #94583 passed with stage
in 2 minutes and 32 seconds
......@@ -19,8 +19,9 @@ COPY ./tailwind.config.cjs /usr/src/app/
COPY ./tsconfig.json /usr/src/app/
COPY ./vite.config.ts /usr/src/app/
EXPOSE 80
RUN pnpm build
EXPOSE 80
VOLUME ["/data"]
CMD [ "pnpm", "dev", "--port", "80", "--host", "0.0.0.0"]
CMD [ "pnpm", "start", "--port", "80", "--host", "0.0.0.0"]
......@@ -14,23 +14,29 @@ export async function init() {
// check if the db file exists
if(!fs.existsSync(dbPath)) {
console.log('Downloading the database file');
const file = fs.createWriteStream(dbPath);
await new Promise((resolve, reject) => {
const request = http.get('https://git.unistra.fr/bramas/s-rank/-/raw/master/db.sqlite', function(response) {
response.pipe(file);
// after download completed close filestream
file.on("finish", () => {
file.close();
console.log("Download Completed");
resolve();
try {
const file = fs.createWriteStream(dbPath);
await new Promise((resolve, reject) => {
const request = http.get('https://git.unistra.fr/bramas/s-rank/-/raw/master/db.sqlite', function(response) {
response.pipe(file);
// after download completed close filestream
file.on("finish", () => {
file.close();
console.log("Download Completed");
resolve();
});
file.on("error", (err) => {
console.log("Error while downloading the database file");
reject(err);
});
});
file.on("error", (err) => {
console.log("Error while downloading the database file");
reject(err);
});
});
});
});
} catch (err) {
console.log("Error while downloading the database file and saving it here: " + dbPath);
console.log("You can set the DATA_PATH environment variable to change the location of the database file");
console.log(err);
}
}
console.log('Database file exists at', dbPath);
......
......@@ -3,4 +3,7 @@ import { defineConfig } from "vite";
export default defineConfig({
plugins: [solid({ ssr: false })],
ssr: {
external: ["sqlite3", "sqlite"],
}
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment