Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
5b41df20
Commit
5b41df20
authored
4 years ago
by
Tom Teichler
Browse files
Options
Downloads
Plain Diff
Merge branch '398-docker-provide-aleksis-base-image' into 'master'
Resolve "[Docker] Provide AlekSIS base image" Closes
#398
See merge request
!511
parents
cf471364
a6c675d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!511
Resolve "[Docker] Provide AlekSIS base image"
Pipeline
#6209
passed
4 years ago
Stage: test
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+2
-0
2 additions, 0 deletions
.gitlab-ci.yml
Dockerfile
+73
-0
73 additions, 0 deletions
Dockerfile
docker-entrypoint.sh
+33
-0
33 additions, 0 deletions
docker-entrypoint.sh
with
108 additions
and
0 deletions
.gitlab-ci.yml
+
2
−
0
View file @
5b41df20
...
...
@@ -9,6 +9,8 @@ include:
file
:
/ci/test/security.yml
-
project
:
"
AlekSIS/official/AlekSIS"
file
:
/ci/build/dist.yml
-
project
:
"
AlekSIS/official/AlekSIS"
file
:
/ci/build/docker.yml
-
project
:
"
AlekSIS/official/AlekSIS"
file
:
/ci/deploy/pages.yml
-
project
:
"
AlekSIS/official/AlekSIS"
...
...
This diff is collapsed.
Click to expand it.
Dockerfile
0 → 100644
+
73
−
0
View file @
5b41df20
FROM
python:3.9-buster
AS
core
# Configure Python to be nice inside Docker and pip to stfu
ENV
PYTHONUNBUFFERED 1
ENV
PYTHONDONTWRITEBYTECODE 1
ENV
PIP_DEFAULT_TIMEOUT 100
ENV
PIP_DISABLE_PIP_VERSION_CHECK 1
ENV
PIP_NO_CACHE_DIR 1
ENV
PIP_EXTRA_INDEX_URL https://edugit.org/api/v4/projects/461/packages/pypi/simple
ENV
PIP_USE_DEPRECATED legacy-resolver
# Configure app settings for build and runtime
ENV
ALEKSIS_static__root /usr/share/aleksis/static
ENV
ALEKSIS_media__root /var/lib/aleksis/media
ENV
ALEKSIS_backup__location /var/lib/aleksis/backups
# Install necessary Debian and PyPI packages for build and runtime
RUN
apt-get
-y
update
&&
\
apt-get
-y
install
eatmydata
&&
\
eatmydata apt-get
-y
upgrade
&&
\
eatmydata apt-get
install
-y
--no-install-recommends
\
build-essential
\
gettext
\
libpq5
\
libpq-dev
\
libssl-dev
\
netcat-openbsd
\
yarnpkg
&&
\
eatmydata pip
install
gunicorn django-compressor
# Install extra dependencies
ARG
EXTRAS="ldap"
RUN case
",
$EXTRAS
,"
in
\
(
*
",ldap,"
*
)
\
eatmydata apt-get
install
-y
--no-install-recommends
\
libldap2-dev
\
libsasl2-dev
\
ldap-utils
\
;;
\
esac
# Install core
RUN
set
-e
;
\
mkdir
-p
/var/lib/aleksis/media /usr/share/aleksis/static /var/lib/aleksis/backups
;
\
eatmydata pip
install
AlekSIS-Core
\[
$EXTRAS
\]
# Declare a persistent volume for all data
VOLUME
/var/lib/aleksis
# Define entrypoint and gunicorn running on port 8000
EXPOSE
8000
COPY
docker-entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT
["/usr/local/bin/entrypoint.sh"]
# Install assets
FROM
core
as
assets
RUN
eatmydata aleksis-admin yarn
install
# Clean up build dependencies
FROM
assets
AS
clean
RUN
set
-e
;
\
eatmydata apt-get remove
--purge
-y
\
build-essential
\
gettext
\
libpq-dev
\
libssl-dev
\
libldap2-dev
\
libsasl2-dev
\
yarnpkg
;
\
eatmydata apt-get autoremove
--purge
-y
;
\
apt-get clean
-y
;
\
rm
-f
/var/lib/apt/lists/
*
_
*
;
\
rm
-rf
/root/.cache
This diff is collapsed.
Click to expand it.
docker-entrypoint.sh
0 → 100755
+
33
−
0
View file @
5b41df20
#!/bin/bash
GUNICORN_BIND
=
${
GUNICORN_BIND
:-
0
.0.0.0
:8000
}
export
ALEKSIS_database__host
=
${
ALEKSIS_database__host
:-
127
.0.0.1
}
export
ALEKSIS_database__port
=
${
ALEKSIS_database__port
:-
5432
}
if
[[
-z
$ALEKSIS_secret_key
]]
;
then
if
[[
!
-e
/var/lib/aleksis/secret_key
]]
;
then
touch
/var/lib/aleksis/secret_key
;
chmod
600 /var/lib/aleksis/secret_key
LC_ALL
=
C
tr
-dc
'A-Za-z0-9!"#$%&'
\'
'()*+,-./:;<=>?@[\]^_`{|}~'
</dev/urandom |
head
-c
64
>
/var/lib/aleksis/secret_key
fi
ALEKSIS_secret_key
=
$(
</var/lib/aleksis/secret_key
)
fi
while
!
nc
-z
$ALEKSIS_database__host
$ALEKSIS_database__port
;
do
sleep
0.1
done
aleksis-admin compilescss
aleksis-admin collectstatic
--no-input
--clear
aleksis-admin migrate
aleksis-admin createinitialrevisions
ARG
=
${
$1
:-
"gunicorn"
}
if
[
$ARG
=
"celery_worker"
]
;
then
exec
celery
-A
aleksis.core worker
-l
info
elif
[
$ARG
=
"celery_beat"
]
;
then
exec
celery
-A
aleksis.core beat
-l
info
--scheduler
django_celery_beat.schedulers:DatabaseScheduler
else
exec
gunicorn aleksis.core.wsgi
--bind
${
GUNICORN_BIND
}
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment