Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Aug 28, 2021
1 parent 52db5a8 commit 5b83012
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
24 changes: 18 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ WORKDIR /usr/local/app

COPY ./ /usr/local/app/

RUN npm install
RUN npm install --loglevel=error

RUN npm run build
RUN npm run build --loglevel=error

FROM nginx:1.21.1
FROM node:15.14.0

COPY --from=build /usr/local/app/dist/Minion /usr/share/nginx/html
COPY --from=build /usr/local/app/nginx.config /etc/nginx/conf.d/default.conf
RUN mkdir -p /usr/local/app/dist

EXPOSE 80
COPY --from=build /usr/local/app/package.json /usr/local/app/package.json
COPY --from=build /usr/local/app/package-lock.json /usr/local/app/package-lock.json
COPY --from=build /usr/local/app/dist /usr/local/app/dist
COPY --from=build /usr/local/app/server.js /usr/local/app/server.js

WORKDIR /usr/local/app/

RUN npm install --loglevel=error

ENV PORT=80

EXPOSE 80

CMD ["node", "server.js"]
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h3 align="center">Minion</h3>
<p align="center">A Single Page Application Boilerplate.</p>
<p align="center">
<a href="https://github.com/Clivern/Minion/releases"><img src="https://img.shields.io/badge/Version-2.1.0-red.svg"></a>
<a href="https://github.com/Clivern/Minion/releases"><img src="https://img.shields.io/badge/Version-2.3.0-red.svg"></a>
<a href="https://github.com/Clivern/Minion/blob/master/LICENSE"><img src="https://img.shields.io/badge/LICENSE-MIT-orange.svg"></a>
</p>
</p>
Expand All @@ -29,6 +29,12 @@ Run the project frontend:
$ make frontend
```

Run with docker

```zsh
$ make deploy
```


## Versioning

Expand Down
13 changes: 0 additions & 13 deletions nginx.config

This file was deleted.

13 changes: 7 additions & 6 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var express = require("express");
var bodyParser = require("body-parser");
const path = require("path");

// Create new instance of the express server
var app = express();
Expand All @@ -11,7 +12,7 @@ app.use(bodyParser.json());
// Create link to Angular build directory
// The `ng build` command will save the result
// under the `dist` folder.
var distDir = __dirname + "/dist/";
var distDir = __dirname + "/dist/Minion/";
app.use(express.static(distDir));

// Init the server
Expand All @@ -21,15 +22,15 @@ var server = app.listen(process.env.PORT || 8080, function () {
});

/**
* GET /
* GET /_health
*/
app.get("/", function (req, res) {
app.get("/api/_health", function (req, res) {
res.status(200).json({ status: "i am ok!" });
});

/**
* GET /_health
* GET /*
*/
app.get("/api/_health", function (req, res) {
res.status(200).json({ status: "i am ok!" });
app.get("/*", function (req, res) {
res.sendFile(path.join(__dirname, "dist/Minion/index.html"));
});

0 comments on commit 5b83012

Please sign in to comment.