Moving maps to their own container

This commit is contained in:
David Négrier 2020-07-23 18:43:51 +02:00
parent ed146226cf
commit 2484e4f1df
25 changed files with 140 additions and 4 deletions

View File

@ -79,6 +79,30 @@ jobs:
tags: ${{ env.GITHUB_REF_SLUG }}
add_git_labels: true
build-maps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Create a slugified value of the branch
- uses: rlespinasse/github-slug-action@master
- name: "Build and push front image"
uses: docker/build-push-action@v1
with:
dockerfile: maps/Dockerfile
path: maps/
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-maps
tags: ${{ env.GITHUB_REF_SLUG }}
add_git_labels: true
deeploy:
needs:
- build-front

View File

@ -19,8 +19,9 @@ export class MapController {
// Returns a map mapping map name to file name of the map
getStartMap() {
this.App.get("/start-map", (req: Request, res: Response) => {
let url = req.headers.host?.replace('api.', 'maps.') + URL_ROOM_STARTED;
res.status(OK).send({
mapUrlStart: req.headers.host + "/map/files" + URL_ROOM_STARTED,
mapUrlStart: url,
startInstance: "global"
});
});

View File

@ -28,6 +28,14 @@
"API_URL": "api."+url
}
},
"maps": {
"image": "thecodingmachine/workadventure-maps:"+tag,
"host": {
"url": "maps."+url,
"https": "enable"
},
"ports": [80]
},
"website": {
"image": "thecodingmachine/workadventure-website:"+tag,
"host": {

View File

@ -44,7 +44,7 @@ services:
DEBUG_MODE: "$DEBUG_MODE"
HOST: "0.0.0.0"
NODE_ENV: development
APACHE_DOCUMENT_ROOT: dist/
#APACHE_DOCUMENT_ROOT: dist/
#APACHE_EXTENSIONS: headers
#APACHE_EXTENSION_HEADERS: 1
STARTUP_COMMAND_0: sudo a2enmod headers

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View File

@ -0,0 +1,47 @@
{
"frames": [
{
"filename": "computer_off",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on1",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 40
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on2",
"frame": {
"w": 42,
"h": 40,
"x": 42,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
}
],
"meta": {
"description": "Atlas generado con Atlas Packer Gamma V2",
"web": "https://gammafp.github.io/atlas-packer-phaser/"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

View File

@ -0,0 +1,47 @@
{
"frames": [
{
"filename": "computer_off",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on1",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 40
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on2",
"frame": {
"w": 42,
"h": 40,
"x": 42,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
}
],
"meta": {
"description": "Atlas generado con Atlas Packer Gamma V2",
"web": "https://gammafp.github.io/atlas-packer-phaser/"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

View File

@ -8,7 +8,7 @@ import {ActionableItem} from "../ActionableItem";
export default {
preload: (loader: Phaser.Loader.LoaderPlugin): void => {
loader.atlas('computer', 'http://maps.workadventure.localhost/computer/computer.png', 'http://maps.workadventure.localhost/computer/computer_atlas.json');
loader.atlas('computer', '/resources/items/computer/computer.png', '/resources/items/computer/computer_atlas.json');
},
create: (scene: GameScene): void => {

9
maps/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
# we are rebuilding on each deploy to cope with the API_URL environment URL
FROM thecodingmachine/nodejs:12-apache
COPY --chown=docker:docker . .
#RUN yarn install
#ENV NODE_ENV=production
#ENV STARTUP_COMMAND_1="yarn run build"
#ENV APACHE_DOCUMENT_ROOT=dist/

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 671 KiB

After

Width:  |  Height:  |  Size: 671 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -42,7 +42,7 @@ class MySprite extends Sprite {
export default {
preload: (loader: Phaser.Loader.LoaderPlugin) => {
loader.atlas('computer', 'http://maps.workadventure.localhost/computer/computer.png', 'http://maps.workadventure.localhost/computer/computer_atlas.json');
loader.atlas('computer', '/resources/items/computer/computer.png', '/resources/items/computer/computer_atlas.json');
},
create: (scene: Scene) => {