Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
backend
Commits
1fe1424a
Commit
1fe1424a
authored
4 months ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Add package caching for CI
parent
9a49e4c2
No related branches found
No related tags found
No related merge requests found
Pipeline
#7318
canceled
4 months ago
Stage: build
Stage: run
Pipeline: backend
#7319
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/Dockerfile
+21
-3
21 additions, 3 deletions
api/Dockerfile
common_py/Dockerfile
+9
-7
9 additions, 7 deletions
common_py/Dockerfile
with
30 additions
and
10 deletions
api/Dockerfile
+
21
−
3
View file @
1fe1424a
# Can be "development" or "production"
# Can be "development" or "production"
ARG
ENV_TYPE
ARG
ENV_TYPE
ARG
GIT_COMMIT_SHA
ARG
GIT_COMMIT_SHA
FROM
registry.git.fsmpi.rwth-aachen.de/videoag/backend/${ENV_TYPE}_common_py:${GIT_COMMIT_SHA}
FROM
registry.git.fsmpi.rwth-aachen.de/videoag/backend/${ENV_TYPE}_common_py:${GIT_COMMIT_SHA}
AS
base
# READ THE NOTE on caching in the README before changing this/for more info!
# READ THE NOTE on caching in the README before changing this/for more info!
ARG
PIP_CACHE_DIR=
ARG
PIP_CACHE_DIR=
ARG
APT_CACHE_DIR=
RUN
rm
-f
/etc/apt/apt.conf.d/docker-clean
RUN if
!
[
-z
"
$APT_CACHE_DIR
"
]
;
then
echo
"Dir::Cache::Archives '
$APT_CACHE_DIR
';"
>
/etc/apt/apt.conf.d/ci_caching
;
fi
ENV
VIDEOAG_API_GIT_COMMIT_HASH $GIT_COMMIT_SHA
ENV
VIDEOAG_API_GIT_COMMIT_HASH $GIT_COMMIT_SHA
COPY
extra_requirements.txt ./
# Install and build requirements in different image too reduce final image size
FROM
base
AS
builder
# READ THE NOTE on caching in the README before changing this/for more info!
# READ THE NOTE on caching in the README before changing this/for more info!
COPY
extra_requirements.txt ./
RUN
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
RUN
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
pip
--python
.venv/bin/python
install
-r
extra_requirements.txt
--mount
=
type
=
cache,target
=
/var/cache/apt,sharing
=
locked
\
--mount
=
type
=
cache,target
=
/var/lib/apt,sharing
=
locked
\
if
!
pip
--python
.venv/bin/python
install
-r
extra_requirements.txt
;
\
then
echo
"Pip failed (packages weren't cached) but you can ignore the error above. We will install the build dependencies and try again"
\
# Packages needed to build lxml with pip
&& apt-get update && apt-get --no-install-recommends install -y gcc python3-dev libxml2-dev libxslt-dev \
&& pip --python .venv/bin/python install -r extra_requirements.txt; \
fi
FROM
base
AS
final
COPY
--from=builder /code/.venv /code/.venv
COPY
docker_start.sh ./
COPY
docker_start.sh ./
COPY
.pylintrc ./
COPY
.pylintrc ./
...
...
This diff is collapsed.
Click to expand it.
common_py/Dockerfile
+
9
−
7
View file @
1fe1424a
...
@@ -12,19 +12,21 @@ WORKDIR /code
...
@@ -12,19 +12,21 @@ WORKDIR /code
RUN
mkdir
-p
/code
RUN
mkdir
-p
/code
WORKDIR
/code
WORKDIR
/code
# Install and build requirements in different image too reduce final image size
# Install and build requirements in different image too reduce final image size
FROM
base
AS
builder
FROM
base
AS
builder
# Packages needed to build psycopg with pip
# READ THE NOTE on caching in the README before changing this/for more info!
# READ THE NOTE on caching in the README before changing this/for more info!
RUN
--mount
=
type
=
cache,target
=
/var/cache/apt,sharing
=
locked
\
--mount
=
type
=
cache,target
=
/var/lib/apt,sharing
=
locked
\
apt-get update
&&
apt-get
--no-install-recommends
install
-y
libpq-dev gcc python3-dev
COPY
requirements.txt /code
COPY
requirements.txt /code
RUN
python
-m
venv
--without-pip
.venv/
RUN
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
RUN
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
pip
--python
/code/.venv/bin/python
install
-r
requirements.txt
--mount
=
type
=
cache,target
=
/var/cache/apt,sharing
=
locked
\
--mount
=
type
=
cache,target
=
/var/lib/apt,sharing
=
locked
\
if
!
pip
--python
.venv/bin/python
install
-r
requirements.txt
;
\
then
echo
"Pip failed (packages weren't cached) but you can ignore the error above. We will install the build dependencies and try again"
\
# Packages needed to build psycopg with pip
&& apt-get update && apt-get --no-install-recommends install -y gcc python3-dev libpq-dev \
&& pip --python .venv/bin/python install -r requirements.txt; \
fi
FROM
base
AS
final
FROM
base
AS
final
...
...
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