Add dockerfile

This commit is contained in:
Sijmen 2019-11-04 00:08:45 +01:00
parent 12abebe69c
commit 492f75cbdf
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48
2 changed files with 19 additions and 8 deletions

4
Dockerfile Normal file
View file

@ -0,0 +1,4 @@
FROM swipl:stable
WORKDIR /app
COPY . .
CMD ["swipl", "-O", "-g", "run", "main.pl"]

23
main.pl
View file

@ -10,15 +10,21 @@
:- use_module(library(http/json_convert)).
:- use_module(library(persistency)).
:- consult('routes/products.pl').
:- consult('routes/login.pl').
:- consult('routes/users.pl').
:- consult('routes/cart.pl').
:- consult('views/products.pl').
:- consult('views/login.pl').
:- ['routes/products.pl'].
:- ['routes/login.pl'].
:- ['routes/users.pl'].
:- ['routes/cart.pl'].
:- ['views/products.pl'].
:- ['views/login.pl'].
hang :-
sleep(600),
hang.
run :-
http_server([port(8080)]),
hang.
:- initialization
http_server([port(8080)]).
:- initialization
absolute_file_name('database.db', File, [access(write)]),
db_attach(File, []),
@ -54,3 +60,4 @@
reply_prolog(Term) :-
prolog_to_json(Term, Json),
reply_json(Json).