Skip to content

Commit

Permalink
Dockerize server
Browse files Browse the repository at this point in the history
  • Loading branch information
Derpthemeus committed Jul 6, 2019
1 parent 152b29d commit 075a5c5
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
.vscode/
private/
js/
highscoreData.json
staticData/
.git/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/js/
/highscoreData.json
/staticData/
/.env
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:carbon AS build
WORKDIR /cml
COPY tsconfig.json ./
COPY package.json ./
COPY package-lock.json ./
# Install all dependencies for compilation.
RUN npm install
COPY ts/ ts/
RUN npm run compile

FROM node:carbon AS run
WORKDIR /cml
COPY --from=build cml/js/ js/
COPY package.json ./
COPY package-lock.json ./
# Install only runtime dependencies.
RUN npm install --only=prod
COPY views/ views/
COPY public/ public/

EXPOSE 8080
ENTRYPOINT ["node", "js/server.js"]
6 changes: 6 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Overrides for running in development.
version: "3.6"
services:
cml:
ports:
- "8080:8080"
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.6"
services:
cml:
build:
context: ./
volumes:
- "staticData:/cml/staticData/"
- "highscoreData:/cml/highscoreData"
environment:
RIOT_API_KEY:
DATA_DIR: "/cml/highscoreData/"
restart: unless-stopped
volumes:
staticData:
highscoreData:
2 changes: 1 addition & 1 deletion ts/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class Config {
public static readonly logApiErrors: boolean = true;

/** The IP address to listen on */
public static readonly serverAddress: string = "127.0.0.1";
public static readonly serverAddress: string = "0.0.0.0";
/** The port to listen on */
public static readonly serverPort: number = 8080;

Expand Down

0 comments on commit 075a5c5

Please sign in to comment.