Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .docker/nginx/conf.d/domain.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
server {
listen 80 default_server;

root /var/www/www;
index index.php index.html index.htm;

client_max_body_size 100M;

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php:9000;
fastcgi_index index.php;

fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
}
18 changes: 18 additions & 0 deletions .docker/node/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- node "$@"
fi

if [ "$1" = 'node' ] || [ "$1" = 'yarn' ]; then
yarn install

>&2 echo "Waiting for PHP to be ready..."
until nc -z "$PHP_HOST" "$PHP_PORT"; do
sleep 1
done
fi

exec "$@"
9 changes: 9 additions & 0 deletions .docker/php/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -e

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi

exec docker-php-entrypoint "$@"
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
ARG PHP_VERSION=8.0
ARG NODE_VERSION=14
ARG NGINX_VERSION=1.16

######### PHP CONFIG
FROM php:${PHP_VERSION}-fpm-alpine as php

WORKDIR /srv/app
COPY www www/

EXPOSE 9000

COPY ./.docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

######### NODE CONFIG
FROM node:${NODE_VERSION}-alpine as node

WORKDIR /srv/app

RUN apk update; \
apk add yarn;
RUN apk add --no-cache --virtual .build-deps alpine-sdk python3

# prevent the reinstallation of vendors at every changes in the source code
COPY package.json yarn.lock ./
COPY tsconfig.json tslint.json webpack.config.js ./
COPY src src/
COPY styles styles/
COPY templates templates/
COPY bin bin/
COPY data data/

RUN set -eux; \
yarn install; \
yarn cache clean; \
yarn build

RUN apk del .build-deps

COPY ./.docker/node/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["yarn", "start"]

######### NGINX CONFIG
FROM nginx:${NGINX_VERSION}-alpine as nginx
COPY .docker/nginx/conf.d/domain.conf /etc/nginx/conf.d/default.conf

WORKDIR /srv/app

COPY --from=node /srv/app/www/assets www/assets
COPY --from=php /srv/app/www/index.php www/index.php
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SatisfactoryTools
Satisfactory Tools for planning and building the perfect base.

# Standard application development
## Requirements
- node.js
- yarn
Expand All @@ -11,15 +12,26 @@ Satisfactory Tools for planning and building the perfect base.
- `yarn install`
- Set up a virtual host pointing to `/www` directory (using e.g. Apache or ngnix)

## Development
Run `yarn start` to start the automated build process. It will watch over the code and rebuild it on change.

# Dockerized application development
## Requirements
- docker
- docker-compose

## Installation / Building
- docker build .

## Development
- docker compose up -d

## Contributing
Any pull requests are welcome, though some rules must be followed:
- try to follow current coding style (there's `tslint` and `.editorconfig`, those should help you with that)
- one PR per feature
- all PRs must target `dev` branch

## Development
Run `yarn start` to start the automated build process. It will watch over the code and rebuild it on change.

## Updating data
Get the latest Docs.json from your game installation and place it into `data` folder.
Then run `yarn parseDocs`command and the `data.json` file would get updated automatically.
Expand All @@ -33,4 +45,4 @@ First you need to extract the images out of the game pack. You need `umodel` (UE
.\umodel.exe -path="C:\Program Files\Epic Games\SatisfactoryExperimental\FactoryGame\Content\Paks" -out=".\out256" -png -export *_256_New.uasset -game=ue4.22
```

After the export is done, copy the resulting `out256` folder to `data/icons`. Then run `yarn generateImages`, which will automatically generate the images in correct sizes and places. `yarn parseDocs` has to be run before this command, if it wasn't run in the previous step.
After the export is done, copy the resulting `out256` folder to `data/icons`. Then run `yarn generateImages`, which will automatically generate the images in correct sizes and places. `yarn parseDocs` has to be run before this command, if it wasn't run in the previous step.
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: "3.2"
services:
nginx:
build:
context: .
target: nginx
depends_on:
- php
- node
ports:
- "80:80"
links:
- php
volumes:
- ./.docker/nginx/conf.d/domain.conf:/etc/nginx/conf.d/default.conf:ro
- ./www:/var/www/www:ro
php:
build:
context: .
target: php
depends_on:
- node
volumes:
- ./www:/var/www/www
- ./node_modules:/var/www/node_modules
node:
build:
context: .
target: node
environment:
PHP_HOST: php
PHP_PORT: 9000
volumes:
- ./src:/var/www/src
- ./styles:/var/www/styles
- ./templates:/var/www/templates
- ./bin:/var/www/bin
- ./data:/var/www/data