-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from Dahlgren/feature/docker
Docker image
- Loading branch information
Showing
6 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
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,7 @@ | ||
.git | ||
config.js | ||
Dockerfile | ||
docker-compose.yml | ||
node_modules | ||
package-lock.json | ||
servers.json |
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,24 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Docker build | ||
run: docker build . --tag arma-server-web-admin | ||
|
||
- name: Docker run tests | ||
run: docker run --env GAME_TYPE=arma3 --env GAME_PATH=/arma3 arma-server-web-admin npm test |
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
strategy: | ||
matrix: | ||
node-version: | ||
- 16.x | ||
- 14.x | ||
- 12.x | ||
- 10.x | ||
|
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,25 @@ | ||
FROM node:16-slim | ||
|
||
# Install arma dependencies | ||
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y git lib32stdc++6 zlib1g:i386 && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install node dependencies for the application | ||
RUN mkdir /app | ||
COPY package.json /app/package.json | ||
WORKDIR /app | ||
RUN npm install | ||
|
||
# Install Docker config | ||
COPY config.docker.js /app/config.js | ||
|
||
# Create empty servers config | ||
RUN echo '[]' > /app/servers.json | ||
|
||
# Copy rest of application to image | ||
COPY . /app/ | ||
|
||
# Start application | ||
CMD npm start | ||
|
||
# Declare application port | ||
EXPOSE 3000 |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
for (var environmentVariable of ['GAME_TYPE', 'GAME_PATH']) { | ||
if (!process.env[environmentVariable]) { | ||
console.log('Missing required environment variable "' + environmentVariable + '"') | ||
process.exit(1) | ||
} | ||
} | ||
|
||
module.exports = { | ||
game: process.env.GAME_TYPE, | ||
path: process.env.GAME_PATH, | ||
port: process.env.PORT || 3000, | ||
host: process.env.HOST || '0.0.0.0', | ||
type: 'linux', | ||
additionalConfigurationOptions: process.env.SERVER_ADDITIONAL_CONFIG, | ||
parameters: (process.env.SERVER_PARAMETERS || '').split(','), | ||
serverMods: (process.env.SERVER_MODS || '').split(','), | ||
admins: (process.env.SERVER_ADMINS || '').split(','), | ||
auth: { | ||
username: process.env.AUTH_USERNAME, | ||
password: process.env.AUTH_PROCESS | ||
}, | ||
prefix: process.env.SERVER_PREFIX, | ||
suffix: process.env.SERVER_SUFFIX, | ||
logFormat: process.env.LOG_FORMAT || 'dev' | ||
} |