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
92b28f48
Verified
Commit
92b28f48
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Introduce multistage build with stages core, core-extras, apps, assets and clean
parent
6185ada4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!208
[Docker] Introduce multistage build
Pipeline
#1265
failed
5 years ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfile
+26
-9
26 additions, 9 deletions
Dockerfile
with
26 additions
and
9 deletions
Dockerfile
+
26
−
9
View file @
92b28f48
FROM
python:3.8-buster
FROM
python:3.8-buster
AS
core
# Configure Python to be nice inside Docker and pip to stfu
ENV
PYTHONUNBUFFERED 1
...
...
@@ -36,7 +36,30 @@ RUN set -e; \
eatmydata poetry
install
;
\
eatmydata pip
install
gunicorn django-compressor
# 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
["/usr/local/bin/entrypoint.sh"]
# Install core extras
FROM
core
AS
core-extras
ARG
EXTRA_LDAP
WORKDIR
/usr/src/app
# LDAP
RUN if
[
$EXTRA_LDAP
=
1
]
;
then
\
eatmydata apt-get
install
-y
--no-install-recommends
\
libldap2-dev
\
libsasl2-dev
\
ldap-utils
;
\
eatmydata poetry
install
-E
ldap
;
\
fi
;
# Install official apps
FROM
core-extras
AS
apps
COPY
apps ./apps/
RUN
set
-e
;
\
for
d
in
apps/official/
*
;
do
\
...
...
@@ -47,11 +70,13 @@ RUN set -e; \
done
# Build messages and assets
FROM
apps
as
assets
RUN
eatmydata python manage.py compilemessages
&&
\
eatmydata python manage.py yarn
install
&&
\
eatmydata python manage.py collectstatic
--no-input
--clear
# Clean up build dependencies
FROM
assets
AS
clean
RUN
set
-e
;
\
eatmydata apt-get remove
--purge
-y
\
build-essential
\
...
...
@@ -64,11 +89,3 @@ RUN set -e; \
eatmydata pip uninstall
-y
poetry
;
\
rm
-f
/var/lib/apt/lists/
*
_
*
;
\
rm
-rf
/root/.cache
# 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
["/usr/local/bin/entrypoint.sh"]
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