From f6871ced2774a88f5177421224e7ae2375404e61 Mon Sep 17 00:00:00 2001 From: Simponic Date: Sat, 4 Jun 2022 16:01:10 -0600 Subject: [PATCH] Add prod branch for launching on simponic.xyz --- .dockerignore | 1 + Dockerfile | 8 ++++++++ docker-compose.yml | 9 +++++++++ src/bootstrap.js | 2 +- src/game.js | 2 +- styles/style.css | 4 ++-- 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fb0b504 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:18.2.0 +ENV NODE_ENV=production + +WORKDIR /app +COPY ["package.json", "package-lock.json*", "./"] +RUN npm install +COPY . . +CMD [ "node", "index.js" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9f3f97b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' + +services: + prod: + build: ./ + ports: + - "3000:3000" + expose: + - 3000 diff --git a/src/bootstrap.js b/src/bootstrap.js index 09e7ec5..b1e4d23 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -106,7 +106,7 @@ game.bootstrap = (() => { const loadLevels = function() { game.levels = []; - fetch('/levels') + fetch('levels') .then((r) => r.json()) .then((r) => game.levels = r); } diff --git a/src/game.js b/src/game.js index 5a7e391..c9fe724 100644 --- a/src/game.js +++ b/src/game.js @@ -31,7 +31,7 @@ game.startLoop = () => { game.lastTimeStamp = performance.now(); game.assets.music.play(); if (game.assets.music.paused) { - alert("Failed to start background music; please allow autoplay in your browser settings."); + alert("Failed to start background music; please allow autoplay in your browser settings and refresh."); } requestAnimationFrame(game.loop); }; diff --git a/styles/style.css b/styles/style.css index 9f0dc5c..6e5ec46 100644 --- a/styles/style.css +++ b/styles/style.css @@ -1,7 +1,7 @@ body { margin: 0; font-family: Lucida Sans Typewriter,Lucida Console,monaco,Bitstream Vera Sans Mono,monospace; - background-image: url("/assets/image/background.gif"); + background-image: url("/bbiy/assets/image/background.gif"); background-size: cover; image-rendering: pixelated; } @@ -70,4 +70,4 @@ body { .menu-button:hover { background-color: #d0d0d0; -} \ No newline at end of file +}