-
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
Showing
32 changed files
with
1,336 additions
and
915 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,31 +1,20 @@ | ||
FROM node:20 as node-build | ||
FROM node:20 | ||
ENV NODE_ENV=production | ||
|
||
WORKDIR /app | ||
WORKDIR /app/frontend | ||
|
||
COPY package*.json ./ | ||
COPY frontend/package*.json ./ | ||
RUN npm install | ||
|
||
COPY . . | ||
COPY frontend/ ./ | ||
RUN npm run production | ||
|
||
FROM composer:2 as composer-build | ||
WORKDIR /app | ||
WORKDIR /app/backend | ||
|
||
COPY composer.json composer.lock ./ | ||
RUN composer install --no-dev | ||
|
||
|
||
FROM php:8.2-apache as run | ||
|
||
RUN docker-php-ext-install mysqli pdo pdo_mysql | ||
|
||
COPY --from=node-build /app/public /var/www/html | ||
COPY --from=composer-build /app/vendor /var/www/vendor | ||
COPY app /var/www/app | ||
|
||
|
||
WORKDIR /var/www/html | ||
COPY backend/package*.json ./ | ||
RUN npm install | ||
|
||
RUN chown -R www-data:www-data /var/www/ | ||
COPY backend/ ./ | ||
|
||
EXPOSE 80 | ||
EXPOSE 3000 | ||
CMD ["node", "index.js"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import express from 'express'; | ||
import mc from "minecraftstatuspinger"; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { dirname } from 'path'; | ||
|
||
const app = express(); | ||
const port = 3000; | ||
const currentFilePath = fileURLToPath(import.meta.url); | ||
const currentDirPath = dirname(currentFilePath); | ||
|
||
// use public | ||
app.use(express.static('../frontend/public')); | ||
|
||
app.get('/', (req, res) => { | ||
const filePath = path.join(currentDirPath, 'views', 'home.html'); | ||
res.sendFile(filePath); | ||
}); | ||
|
||
app.get('/ping', async (_, res) => { | ||
try { | ||
let result = await mc.lookup({ host: "mc.chs.se" }); | ||
res.send(result); | ||
} catch (error) { | ||
res.status(500).send("An error occurred while pinging the server."); | ||
} | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`App listening at http://localhost:${port}`); | ||
}); |
Oops, something went wrong.