Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
18883039
Commit
18883039
authored
1 year ago
by
Bastien Abadie
Browse files
Options
Downloads
Patches
Plain Diff
Remove Docker binary build
parent
24db1780
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2232
Remove Docker binary build
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-23
1 addition, 23 deletions
.gitlab-ci.yml
Dockerfile.binary
+0
-72
0 additions, 72 deletions
Dockerfile.binary
ci/build.sh
+2
-7
2 additions, 7 deletions
ci/build.sh
with
3 additions
and
102 deletions
.gitlab-ci.yml
+
1
−
23
View file @
18883039
...
...
@@ -154,29 +154,7 @@ backend-build:
-
when
:
never
script
:
-
ci/build.sh Dockerfile
backend-build-binary-docker
:
stage
:
build
image
:
docker:19.03.1
services
:
-
docker:dind
variables
:
DOCKER_DRIVER
:
overlay2
DOCKER_HOST
:
tcp://docker:2375/
# Run this on master and tags except base tags and schedules
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"schedule"'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"'
when
:
on_success
-
if
:
'
$CI_COMMIT_TAG
&&
$CI_COMMIT_TAG
!~
/^base-.*/'
when
:
on_success
-
when
:
never
script
:
-
ci/build.sh Dockerfile.binary "-binary"
-
ci/build.sh
# Make sure arkindex is always compatible with Nuitka
backend-build-binary
:
...
...
This diff is collapsed.
Click to expand it.
Dockerfile.binary
deleted
100644 → 0
+
0
−
72
View file @
24db1780
# syntax=docker/dockerfile:1
FROM python:3.10-slim-bookworm AS compilation
RUN apt-get update && apt-get install --no-install-recommends -y build-essential wget
RUN pip install nuitka
# We build in /usr/share because Django will try to load some files relative to that path
# once executed in the binary (management commands, ...)
WORKDIR /usr/share
# Add our own source code
ADD arkindex /usr/share/arkindex
ADD base/requirements.txt /tmp/requirements-base-arkindex.txt
ADD requirements.txt /tmp/requirements-arkindex.txt
# Build full requirements, removing relative or remote references to arkindex projects
RUN cat /tmp/requirements-*arkindex.txt | sort | uniq | grep -v -E '^arkindex|^#' > /requirements.txt
# List all management commands
RUN find /usr/share/arkindex/*/management -name '*.py' -not -name '__init__.py' > /commands.txt
# Remove arkindex unit tests
RUN find /usr/share/arkindex -type d -name tests | xargs rm -rf
# This configuration is needed to avoid a compilation crash at linking stage
# It only seems to happen on recent gcc
# See https://github.com/Nuitka/Nuitka/issues/959
ENV NUITKA_RESOURCE_MODE=linker
# Compile all our python source code
# Do not use the -O or -OO python flags here as it removes assert statements (see backend#432)
RUN python -m nuitka \
--nofollow-imports \
--include-package=arkindex \
--show-progress \
--lto=yes \
--output-dir=/build \
arkindex/manage.py
# Start over from a clean setup
FROM registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia as build
# Import files from compilation
RUN mkdir /usr/share/arkindex
COPY --from=compilation /build/manage.bin /usr/bin/arkindex
COPY --from=compilation /requirements.txt /usr/share/arkindex
COPY --from=compilation /commands.txt /usr/share/arkindex
# Install open source Python dependencies
# We also add gunicorn, to be able to run `arkindex gunicorn`
RUN pip install -r /usr/share/arkindex/requirements.txt gunicorn
# Setup Arkindex VERSION
COPY VERSION /etc/arkindex.version
# Copy templates in base dir for binary
ENV BASE_DIR=/usr/share/arkindex
COPY arkindex/templates /usr/share/arkindex/templates
COPY arkindex/documents/export/*.sql /usr/share/arkindex/documents/export/
# Touch python files for needed management commands
# Otherwise Django will not load the compiled module
RUN for cmd in $(cat /usr/share/arkindex/commands.txt); do mkdir -p $(dirname $cmd); touch $cmd; done
HEALTHCHECK --start-period=1m --start-interval=1s --interval=1m --timeout=5s \
CMD wget --spider --quiet http://localhost/api/v1/public-key/ || exit 1
# Run gunicorn server
ENV PORT=80
EXPOSE $PORT
CMD arkindex gunicorn --host=0.0.0.0 --port $PORT
This diff is collapsed.
Click to expand it.
ci/build.sh
+
2
−
7
View file @
18883039
...
...
@@ -5,12 +5,7 @@
# Will automatically login to a registry if CI_REGISTRY, CI_REGISTRY_USER and CI_REGISTRY_PASSWORD are set.
# Will only push an image if $CI_REGISTRY is set.
DOCKERFILE
=
$1
TAG_SUFFIX
=
$2
if
[
-z
"
$DOCKERFILE
"
]
;
then
echo
"Missing dockerfile on CLI"
exit
1
fi
TAG_SUFFIX
=
$1
if
[
-z
"
$VERSION
"
]
;
then
#Ensure this is not a base tag
...
...
@@ -41,7 +36,7 @@ IMAGE_TAG="$CI_REGISTRY_IMAGE:$VERSION"
cd
$CI_PROJECT_DIR
docker pull
"
$CI_REGISTRY_IMAGE
/base:latest"
docker build
.
-f
$DOCKERFILE
-t
"
$IMAGE_TAG
"
docker build
.
-t
"
$IMAGE_TAG
"
if
[
-n
"
$CI_REGISTRY
"
]
;
then
docker push
"
$IMAGE_TAG
"
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