feat: add Docker image, Compose file and image CI
This commit is contained in:
parent
0c31eb4b25
commit
748813bc05
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.git
|
||||||
|
Dockerfile*
|
||||||
|
.*
|
@ -1,4 +0,0 @@
|
|||||||
# Docker may need a .env file for the following settings:
|
|
||||||
DATABASE_PORT=27017
|
|
||||||
DATABASE_USERNAME=root
|
|
||||||
DATABASE_PASSWORD=database
|
|
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@ -20,3 +20,23 @@ jobs:
|
|||||||
- run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
|
- run: echo '{"version":"","buildLabel":"","matchmakingBuildId":""}' > static/data/buildConfig.json
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Log in to container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:latest
|
||||||
|
ghcr.io/${{ github.repository}}:${{ github.sha }}
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -16,3 +16,7 @@ yarn.lock
|
|||||||
|
|
||||||
# MongoDB VSCode extension playground scripts
|
# MongoDB VSCode extension playground scripts
|
||||||
/database_scripts
|
/database_scripts
|
||||||
|
|
||||||
|
# Default Docker directories
|
||||||
|
/static-data
|
||||||
|
/database
|
||||||
|
29
Dockerfile
29
Dockerfile
@ -1,5 +1,28 @@
|
|||||||
FROM mongo as base
|
FROM node:18-alpine3.19
|
||||||
|
|
||||||
EXPOSE 27017
|
ENV APP_MONGODB_URL=mongodb://mongodb:27017/openWF
|
||||||
|
ENV APP_MY_ADDRESS=localhost
|
||||||
|
ENV APP_HTTP_PORT=80
|
||||||
|
ENV APP_HTTPS_PORT=443
|
||||||
|
ENV APP_AUTO_CREATE_ACCOUNT=true
|
||||||
|
ENV APP_SKIP_STORY_MODE_CHOICE=true
|
||||||
|
ENV APP_SKIP_TUTORIAL=true
|
||||||
|
ENV APP_SKIP_ALL_DIALOGUE=true
|
||||||
|
ENV APP_UNLOCK_ALL_SCANS=true
|
||||||
|
ENV APP_UNLOCK_ALL_MISSIONS=true
|
||||||
|
ENV APP_UNLOCK_ALL_QUESTS=true
|
||||||
|
ENV APP_COMPLETE_ALL_QUESTS=true
|
||||||
|
ENV APP_INFINITE_RESOURCES=true
|
||||||
|
ENV APP_UNLOCK_ALL_SHIP_FEATURES=true
|
||||||
|
ENV APP_UNLOCK_ALL_SHIP_DECORATIONS=true
|
||||||
|
ENV APP_UNLOCK_ALL_FLAVOUR_ITEMS=true
|
||||||
|
ENV APP_UNLOCK_ALL_SKINS=true
|
||||||
|
ENV APP_UNIVERSAL_POLARITY_EVERYWHERE=true
|
||||||
|
ENV APP_SPOOF_MASTERY_RANK=-1
|
||||||
|
|
||||||
CMD ["mongod"]
|
RUN apk add --no-cache bash sed wget jq
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
|
@ -1,24 +1,42 @@
|
|||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mongodb:
|
openwf:
|
||||||
container_name: mongodb
|
# build: .
|
||||||
image: mongodb
|
image: ghcr.io/spaceninjaserver/SpaceNinjaServer:latest
|
||||||
restart: always
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
target: base
|
|
||||||
environment:
|
environment:
|
||||||
MONGO_INITDB_ROOT_USERNAME: ${DATABASE_USERNAME}
|
APP_MONGODB_URL: mongodb://openwfagent:spaceninjaserver@mongodb:27017/
|
||||||
MONGO_INITDB_ROOT_PASSWORD: ${DATABASE_PASSWORD}
|
|
||||||
ports:
|
|
||||||
- ${DATABASE_PORT}:${DATABASE_PORT}
|
|
||||||
expose:
|
|
||||||
- "${DATABASE_PORT}"
|
|
||||||
networks:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
networks:
|
# Following environment variables are set to default image values.
|
||||||
docker:
|
# Uncomment to edit.
|
||||||
external: true
|
|
||||||
|
# APP_MY_ADDRESS: localhost
|
||||||
|
# APP_HTTP_PORT: 80
|
||||||
|
# APP_HTTPS_PORT: 443
|
||||||
|
# APP_AUTO_CREATE_ACCOUNT: true
|
||||||
|
# APP_SKIP_STORY_MODE_CHOICE: true
|
||||||
|
# APP_SKIP_TUTORIAL: true
|
||||||
|
# APP_SKIP_ALL_DIALOGUE: true
|
||||||
|
# APP_UNLOCK_ALL_SCANS: true
|
||||||
|
# APP_UNLOCK_ALL_MISSIONS: true
|
||||||
|
# APP_UNLOCK_ALL_QUESTS: true
|
||||||
|
# APP_COMPLETE_ALL_QUESTS: true
|
||||||
|
# APP_INFINITE_RESOURCES: true
|
||||||
|
# APP_UNLOCK_ALL_SHIP_FEATURES: true
|
||||||
|
# APP_UNLOCK_ALL_SHIP_DECORATIONS: true
|
||||||
|
# APP_UNLOCK_ALL_FLAVOUR_ITEMS: true
|
||||||
|
# APP_UNLOCK_ALL_SKINS: true
|
||||||
|
# APP_UNIVERSAL_POLARITY_EVERYWHERE: true
|
||||||
|
# APP_SPOOF_MASTERY_RANK: -1
|
||||||
|
volumes:
|
||||||
|
- ./static-data:/app/static/data
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
depends_on:
|
||||||
|
- mongodb
|
||||||
|
mongodb:
|
||||||
|
image: docker.io/library/mongo:8.0.0-noble
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: openwfagent
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: spaceninjaserver
|
||||||
|
volumes:
|
||||||
|
- ./database:/app/static/data
|
||||||
|
29
docker-entrypoint.sh
Executable file
29
docker-entrypoint.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Set up the configuration file using environment variables.
|
||||||
|
echo '{
|
||||||
|
"logger": {
|
||||||
|
"files": true,
|
||||||
|
"level": "trace",
|
||||||
|
"__valid_levels": "fatal, error, warn, info, http, debug, trace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' > config.json
|
||||||
|
|
||||||
|
for config in $(env | grep "APP_")
|
||||||
|
do
|
||||||
|
var=$(echo "${config}" | tr '[:upper:]' '[:lower:]' | sed 's/app_//g' | sed -E 's/_([a-z])/\U\1/g' | sed 's/=.*//g')
|
||||||
|
val=$(echo "${config}" | sed 's/.*=//g')
|
||||||
|
jq --arg variable "$var" --arg value "$val" '.[$variable] += $value' config.json > config.tmp
|
||||||
|
mv config.tmp config.json
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -f "/app/static/data/buildConfig.json" ]
|
||||||
|
then
|
||||||
|
echo "buildConfig not found, refusing to start."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
npm install
|
||||||
|
exec npm run dev
|
Loading…
x
Reference in New Issue
Block a user