Skip to content
GitLab
Explore
Sign in
Tools
Docker
Simple OPDS
Compare revisions
a9bf5f958282d446849b7d50b6ea16738cfe3741 to 690eb8b363a63f7f5d7b17b9341cac561067ae7c
Commits on Source (2)
no more alpine
· 7a15d625
Дмитрий Сафронов
authored
Sep 21, 2023
7a15d625
Merge branch 'dockerfile' into 'master'
· 690eb8b3
Дмитрий Сафронов
authored
Sep 21, 2023
no more alpine See merge request
!5
690eb8b3
Hide whitespace changes
Inline
Side-by-side
.hadolint.yaml
View file @
690eb8b3
ignored
:
ignored
:
-
DL3007
-
DL3007
-
DL3008
-
DL3013
-
DL3013
-
DL3018
-
DL3018
-
DL4006
-
DL4006
Dockerfile
View file @
690eb8b3
ARG
DOCKER_REGISTRY=registry.cyberbrain.pw
ARG
DOCKER_REGISTRY=registry.cyberbrain.pw
ARG
DOCKER_IMAGE_GIT=$DOCKER_REGISTRY/tools/docker/git
ARG
DOCKER_IMAGE_UBUNTU=$DOCKER_REGISTRY/tools/docker/ubuntu
############################################################
############################################################
FROM
$DOCKER_
REGISTRY/tools/docker/git
:latest
AS
git
FROM
$DOCKER_
IMAGE_GIT
:latest
AS
git
RUN
set
-ex
&&
\
RUN
set
-ex
&&
\
(
git clone
--depth
=
1 https://gitlab.cyberbrain.pw/tools/mirror/sopds.git /tmp
||
echo
error: failed to clone master repository.
)
&&
\
(
git clone
--depth
=
1 https://gitlab.cyberbrain.pw/tools/mirror/sopds.git /tmp
||
echo
error: failed to clone master repository.
)
&&
\
ls
-la
/tmp
ls
-la
/tmp
############################################################
############################################################
FROM
alpine:3.17
AS
base
FROM
$DOCKER_IMAGE_UBUNTU:latest
AS
base
ENV
PYTHONDONTWRITEBYTECODE 1
ENV
PYTHONDONTWRITEBYTECODE 1
ENV
PYTHONUNBUFFERED 1
ENV
PYTHONUNBUFFERED 1
ENV
BASE_DEPENDENCIES="
sudo un
zip"
ENV
BASE_DEPENDENCIES="
python3 python3-venv libpq5 libmariadb3 libxml2 libxslt1.1 libffi8 libjpeg8 zlib1g xz-utils b
zip
2
"
ENV
PATH="/opt/sopds/bin:$PATH"
ENV
PATH="/opt/sopds/bin:$PATH"
WORKDIR
/home/sopds
WORKDIR
/home/sopds
RUN
set
-ex
&&
\
RUN
apt-get update
&&
\
apk
--no-cache
add python3
${
BASE_DEPENDENCIES
}
&&
\
apt-get
install
--no-install-recommends
-y
${
BASE_DEPENDENCIES
}
&&
\
rm
-rf
/var/cache/apk/
*
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
############################################################
############################################################
FROM
base
AS
builder
FROM
base
AS
builder
ENV
BUILD_DEPENDENCIES="
gcc build-base python3-dev musl-dev mariadb-connector-c
-dev libpq-dev libxml2-dev libxslt-dev libffi-dev jpeg-dev zlib-dev
xz-dev bzip
2-dev"
ENV
BUILD_DEPENDENCIES="
pkg-config build-essential python3-dev libmariadb
-dev libpq-dev libxml2-dev libxslt-dev libffi-dev
lib
jpeg-dev zlib
1g
-dev
liblzma-dev libbz
2-dev"
COPY
--from=git /tmp/requirements.txt /home/sopds/
COPY
--from=git /tmp/requirements.txt /home/sopds/
COPY
requirements-override.txt /home/sopds/
COPY
requirements-override.txt /home/sopds/
RUN
set
-ex
&&
\
RUN
apt-get update
&&
\
apk
--no-cache
add
--virtual
build-dependencies
${
BUILD_DEPENDENCIES
}
&&
\
apt-get
install
--no-install-recommends
-y
${
BUILD_DEPENDENCIES
}
&&
\
apt-get clean
&&
\
rm
-rf
/var/lib/apt/lists/
*
&&
\
python3
-m
venv /opt/sopds
&&
\
python3
-m
venv /opt/sopds
&&
\
pip3
install
--ignore-installed
--no-cache-dir
--upgrade
--disable-pip-version-check
pip setuptools wheel
&&
\
pip3
install
--ignore-installed
--no-cache-dir
--upgrade
--disable-pip-version-check
pip setuptools wheel
&&
\
pip3
install
--ignore-installed
--no-cache-dir
-r
requirements.txt
-r
requirements-override.txt
&&
\
pip3
install
--ignore-installed
--no-cache-dir
-r
requirements.txt
-r
requirements-override.txt
&&
\
find /opt/sopds
\(
-type
d
-a
-name
test
-o
-name
tests
\)
-o
\(
-type
f
-a
-name
'*.pyc'
-o
-name
'*.pyo'
\)
-exec
rm
-rvf
'{}'
\+
&&
\
find /opt/sopds
\(
-type
d
-a
-name
test
-o
-name
tests
\)
-o
\(
-type
f
-a
-name
'*.pyc'
-o
-name
'*.pyo'
\)
-exec
rm
-rvf
'{}'
\+
#apk del build-dependencies &&
\
rm
-rf
/var/cache/apk/
*
############################################################
############################################################
FROM
base
AS
runtime
FROM
base
AS
runtime
ENV
RUNTIME_DEPENDENCIES="
libpq mariadb-connector-c libxml2 libxslt libffi libjpeg zlib xz-libs libbz2
" \
ENV
RUNTIME_DEPENDENCIES="
sudo unzip
" \
OWNER_UID=1000 \
OWNER_UID=1000 \
OWNER_GID=1000
OWNER_GID=1000
RUN
set
-ex
&&
\
RUN
apt-get update
&&
\
apk
--no-cache
add
${
RUNTIME_DEPENDENCIES
}
&&
\
apt-get
install
--no-install-recommends
-y
${
RUNTIME_DEPENDENCIES
}
&&
\
rm
-rf
/var/cache/apk/
*
&&
\
apt-get clean
&&
\
(
addgroup
-g
$OWNER_GID
sopds
||
echo
sopds:x:
$OWNER_GID
:sopds |
tee
-a
/etc/group
)
&&
\
rm
-rf
/var/lib/apt/lists/
*
&&
\
(
adduser
-D
-h
/home/sopds
-G
sopds
-u
$OWNER_UID
sopds
||
echo
sopds:x:
$OWNER_UID
:
$OWNER_GID
:Linux User,,,:/home/sopds:/bin/ash |
tee
-a
/etc/passwd
)
&&
\
(
addgroup
--system
--gid
$OWNER_GID
sopds
||
echo
sopds:x:
$OWNER_GID
:sopds |
tee
-a
/etc/group
)
&&
\
(
adduser
--system
--home
/home/sopds
--ingroup
sopds
--uid
$OWNER_UID
sopds
--shell
/bin/sh
||
echo
sopds:x:
$OWNER_UID
:
$OWNER_GID
:Linux User,,,:/home/sopds:/bin/sh |
tee
-a
/etc/passwd
)
&&
\
chown
-R
sopds:sopds /home/sopds
chown
-R
sopds:sopds /home/sopds
COPY
--from=builder /opt/sopds/ /opt/sopds/
COPY
--from=builder /opt/sopds/ /opt/sopds/
COPY
--from=git --chown=sopds:sopds /tmp/ /home/sopds/
COPY
--from=git --chown=sopds:sopds /tmp/ /home/sopds/
...
...