Working docker version.

master
Thomas Hintz 1 year ago
parent 9fdbcc34f9
commit 526c4ae365

@ -0,0 +1,5 @@
/node_modules/
/node_modules_bak/
/dist/
*~
/src/server/farm

@ -0,0 +1,59 @@
FROM alpine as chicken
ENV CHICKEN_VERSION 4.11.0
ENV PLATFORM linux
RUN set -eux; \
apk update; \
apk --no-cache --update add build-base; \
wget -qO- https://code.call-cc.org/releases/${CHICKEN_VERSION}/chicken-${CHICKEN_VERSION}.tar.gz | tar xzv; \
cd /chicken-${CHICKEN_VERSION}; \
make PLATFORM=${PLATFORM}; \
make PLATFORM=${PLATFORM} install; \
make PLATFORM=${PLATFORM} check; \
cd /; \
rm -rf /chicken-${CHICKEN_VERSION}
FROM chicken as deps
RUN chicken-install http-session srfi-69 coops uri-common srfi-18 medea numbers spiffy spiffy-cookies sql-de-lite crypt intarweb sxml-transforms websockets miscmacros
FROM deps as deps2
RUN chicken-install -r pll; \
cd pll; \
sed -i '1s/^/(import scheme)\n/' amb.scm; \
chicken-install
FROM deps2 as compat
RUN apk --no-cache --update add libc6-compat
FROM node:16 as node
WORKDIR /farm
# COPY ./ /farm
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm install
FROM node as buildfe
WORKDIR /farm
COPY ./ /farm
RUN make prodfe
FROM compat as buildfarm
WORKDIR /farm
COPY ./ /farm
RUN make farm
FROM buildfarm as farm
WORKDIR /farm
RUN mkdir dist
COPY --from=buildfe /farm/dist /farm/dist
RUN cp src/server/farm dist/; \
chmod +x dist/farm; \
touch dist/db
FROM farm as run
WORKDIR /farm/dist
ENTRYPOINT ["./farm"]
CMD ["-:a50"]
# CMD ./farm

@ -21,6 +21,9 @@
assets := assets/game/acf/
docker:
sudo docker build --network=host . -t farm
dev:
npx webpack --config webpack.dev.js --env.assets ./$(assets)
@ -34,6 +37,9 @@ rundevserver:
prod: src/server/farm
npx webpack --config webpack.prod.js --env.assets ./$(assets)
prodfe:
npx webpack --config webpack.prod.js --env.assets ./$(assets)
install:
npm init -y
npm install

Binary file not shown.

@ -0,0 +1,94 @@
Copyright (c) 2012, Pablo Impallari (www.impallari.com|impallari@gmail.com),
Copyright (c) 2012, Rodrigo Fuenzalida (www.rfuenzalida.com|hello<6C>rfuenzalida.com), with Reserved Font Name Libre Baskerville.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

@ -0,0 +1,93 @@
Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

17500
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -34,11 +34,9 @@
"css-loader": "^3.4.2",
"css-url-relative-plugin": "^1.0.0",
"cypress": "^4.4.1",
"favicons-webpack-plugin": "^2.1.0",
"file-loader": "^4.3.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.2",
"node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0",
"react-refresh": "^0.8.3",
@ -59,6 +57,7 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"redux": "^4.0.5"
"redux": "^4.0.5",
"sass": "^1.69.5"
}
}

@ -1,6 +1,7 @@
(use sql-de-lite crypt)
(define *db* "/home/tjhintz/db")
;; (define *db* "/home/tjhintz/db")
(define *db* "/farm/dist/db")
(define-syntax with-db
(syntax-rules ()
@ -11,11 +12,11 @@
(define (create-tables)
(with-db (db)
(exec (sql db "create table users(id INTEGER PRIMARY KEY, username TEXT, email TEXT, password TEXT, salt TEXT);"))
(exec (sql db "create table sessions(bindings TEXT, session_id TEXT PRIMARY KEY);"))
(exec (sql db "create table games(id INTEGER PRIMARY KEY, status TEXT, object TEXT, updated INTEGER);"))
(exec (sql db "create table players(id INTEGER PRIMARY KEY, object TEXT);"))
(exec (sql db "create table user_games(user_id INTEGER, game_id INTEGER);"))))
(exec (sql db "create table if not exists users(id INTEGER PRIMARY KEY, username TEXT, email TEXT, password TEXT, salt TEXT);"))
(exec (sql db "create table if not exists sessions(bindings TEXT, session_id TEXT PRIMARY KEY);"))
(exec (sql db "create table if not exists games(id INTEGER PRIMARY KEY, status TEXT, object TEXT, updated INTEGER);"))
(exec (sql db "create table if not exists players(id INTEGER PRIMARY KEY, object TEXT);"))
(exec (sql db "create table if not exists user_games(user_id INTEGER, game_id INTEGER);"))))
(define (db-session-set! sid bindings)
(with-db (db)

@ -448,7 +448,8 @@
;; (access-log (current-output-port))
(access-log "access.log")
(error-log "error.log")
;; (error-log "error.log")
(error-log (current-output-port))
(handle-not-found
(let ((old-handler (handle-not-found)))
@ -2742,9 +2743,10 @@
(run-awful)
(repl))
(compiling ;; production
(create-tables)
(run-awful)
(repl)
;; (thread-join! *server-thread*)
(thread-join! *server-thread*)
))
;; TODO

@ -19,7 +19,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
// const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const webpack = require("webpack");
@ -48,7 +48,7 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin(),
new FaviconsWebpackPlugin('./assets/img/tractor.svg'),
// new FaviconsWebpackPlugin('./assets/img/tractor.svg'),
new MiniCssExtractPlugin({
filename: './assets/[name].[hash].css',
chunkFilename: './assets/[id].[hash].css',

Loading…
Cancel
Save