Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Chiefs
ChiefSend
Commits
4d4a9ab5
Commit
4d4a9ab5
authored
Oct 04, 2020
by
Lukas Böhm
Browse files
Docker installation fix
docker installation should now work on a completly new environment
parent
b385cd0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
4d4a9ab5
FROM
python:3.8-alpine
WORKDIR
/chiefsend
WORKDIR
/home
/chiefsend
# get python ready
COPY
./requirements.txt ./requirements.txt
RUN
pip
install
-r
requirements.txt
RUN
pip
install
gunicorn
...
...
@@ -9,14 +10,9 @@ RUN pip install gunicorn
# copy actual app
COPY
app app
COPY
chiefsend.py chiefsend.py
COPY
start.sh start.sh
COPY
init_db.py init_db.py
COPY
home.db home.db
RUN
chmod
+x start.sh
ENV
FLASK_APP chiefsend.py
EXPOSE
5000
ENTRYPOINT
gunicorn -b :5000 --access-logfile - --error-logfile - chiefsend:app
README.md
View file @
4d4a9ab5
...
...
@@ -11,7 +11,7 @@ Eine Tolle Webapp zum Austausch von Dateien
`docker build -t chiefsend:latest .`
`docker run --name chiefsend-test -d -p 8000:5000 --mount source=chiefsend-vol,target=
/chiefsend
--rm chiefsend:latest`
`docker run --name chiefsend-test -d -p 8000:5000 --mount source=chiefsend-vol,target=
./data
--rm chiefsend:latest`
## Removing
`docker container stop chiefsend-test`
...
...
app/__init__.py
View file @
4d4a9ab5
...
...
@@ -4,15 +4,22 @@ from flask_sqlalchemy import SQLAlchemy
print
(
'WE GOIN IN BOIS'
)
basedir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
))
datadir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
basedir
,
'data'
))
print
(
basedir
)
print
(
datadir
)
app
=
Flask
(
__name__
)
app
.
config
[
'SECRET_KEY'
]
=
os
.
getenv
(
'SECRET_KEY'
)
or
'jonas ist ein kek'
app
.
config
[
'MEDIA_LOCATION'
]
=
os
.
getenv
(
'MEDIA_LOCATION'
)
or
os
.
path
.
join
(
base
dir
,
'media'
)
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
os
.
getenv
(
'DATABASE_URI'
)
or
'sqlite:///'
+
os
.
path
.
join
(
base
dir
,
'home.db'
)
app
.
config
[
'MEDIA_LOCATION'
]
=
os
.
getenv
(
'MEDIA_LOCATION'
)
or
os
.
path
.
join
(
data
dir
,
'media'
)
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
os
.
getenv
(
'DATABASE_URI'
)
or
'sqlite:///'
+
os
.
path
.
join
(
data
dir
,
'home.db'
)
app
.
config
[
'SQLALCHEMY_TRACK_MODIFICATIONS'
]
=
False
app
.
config
[
'MAX_MEDIA_SIZE'
]
=
1000
*
1024
*
1024
# 1000 MB
db
=
SQLAlchemy
(
app
)
from
app
import
models
,
routes
from
app.models
import
*
db
.
create_all
()
db
.
session
.
commit
()
from
app
import
routes
init_db.py
deleted
100644 → 0
View file @
b385cd0d
from
flask
import
Flask
from
flask_sqlalchemy
import
SQLAlchemy
import
os
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
app
=
Flask
(
__name__
)
app
.
config
[
'SECRET_KEY'
]
=
'kekw'
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
os
.
path
.
join
(
'basedir'
,
'home.db'
)
app
.
config
[
'SQLALCHEMY_TRACK_MODIFICATIONS'
]
=
False
db
=
SQLAlchemy
(
app
)
from
app.models
import
*
app
.
app_context
().
push
()
db
.
drop_all
()
db
.
create_all
()
db
.
session
.
commit
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment