Skip to content

Commit f77ec2c

Browse files
committed
Updates on docs
1 parent 2dd223b commit f77ec2c

File tree

5 files changed

+85
-63
lines changed

5 files changed

+85
-63
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ indent_size = 4
2929
[*.{md, markdown}]
3030
max_line_length = off
3131
trim_trailing_whitespace = false
32+
33+
[*.sh]
34+
indent_size = 4

distribution/docker-images/dev.Dockerfile

+20-20
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ ARG APT_INSTALL_OPTIONS="--assume-yes --no-install-recommends --only-upgrade"
6262
## setup image labels
6363
LABEL "name"="$IMAGE_NAME" \
6464
"version"="$IMAGE_VERSION" \
65-
"com.github.image.title"="$IMAGE_NAME" \
66-
"com.github.image.description"="$IMAGE_DESCRIPTION" \
67-
"com.github.image.vendor"="$IMAGE_VENDOR" \
68-
"com.github.image.url"="$IMAGE_URL" \
69-
"com.github.image.authors"="$IMAGE_AUTHORS" \
70-
"com.github.image.licenses"="$IMAGE_LICENSES" \
71-
"com.github.image.documentation"="$IMAGE_DOCUMENTATION" \
72-
"com.github.image.source"="$IMAGE_URL" \
73-
"com.github.image.revision"="$IMAGE_REVISION" \
74-
"com.github.image.version"="$IMAGE_VERSION" \
75-
"com.github.image.created"="$IMAGE_BUILD_DATE"
65+
"org.opencontainers.image.title"="$IMAGE_NAME" \
66+
"org.opencontainers.image.description"="$IMAGE_DESCRIPTION" \
67+
"org.opencontainers.image.vendor"="$IMAGE_VENDOR" \
68+
"org.opencontainers.image.url"="$IMAGE_URL" \
69+
"org.opencontainers.image.authors"="$IMAGE_AUTHORS" \
70+
"org.opencontainers.image.licenses"="$IMAGE_LICENSES" \
71+
"org.opencontainers.image.documentation"="$IMAGE_DOCUMENTATION" \
72+
"org.opencontainers.image.source"="$IMAGE_URL" \
73+
"org.opencontainers.image.revision"="$IMAGE_REVISION" \
74+
"org.opencontainers.image.version"="$IMAGE_VERSION" \
75+
"org.opencontainers.image.created"="$IMAGE_BUILD_DATE"
7676

7777
## setup shell options
7878
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
@@ -122,9 +122,9 @@ RUN adduser \
122122
|| exit 0
123123

124124
# Run commands as user
125-
RUN whoami && \
126-
# opt-out of the new security feature, not needed in a CI environment
127-
git config --global --add safe.directory '*'
125+
RUN whoami \
126+
# opt-out of the new security feature, not needed in a CI environment
127+
&& git config --global --add safe.directory '*'
128128

129129
## mount volumes
130130
VOLUME ["$APP_DIR", "$DATA_DIR", "$TEMP_DIR"]
@@ -157,9 +157,9 @@ RUN cd /tmp && curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Pytho
157157
ln -s /usr/local/bin/python3.8 /usr/bin/python3.8
158158

159159
## show versions
160-
RUN echo "npm version: $(npm --version)" \
161-
&& echo "node version: $(node --version | awk -F. '{print $1}')" \
162-
&& echo "python version: $(python3 --version)"
160+
RUN echo ">>> npm version: $(npm --version)" \
161+
&& echo ">>> node version: $(node --version | awk -F. '{print $1}')" \
162+
&& echo ">>> python version: $(python3 --version)"
163163

164164
## setup entrypoint
165165
ENTRYPOINT [ "/usr/bin/tini", "--" ]
@@ -184,8 +184,8 @@ ARG PYTHON_INSTALL_OPTIONS="--no-ansi --upgrade"
184184
## setup python dependencies stage
185185
RUN echo "**** Installing python modules stage ****"
186186

187-
RUN /usr/bin/python3.8 -m pip install $PYTHON_INSTALL_OPTIONS $PYTHON_INSTALL_PACKAGES && \
188-
/usr/bin/python3.8 -m pip install $PYTHON_INSTALL_OPTIONS -r requirements.txt
187+
RUN /usr/local/bin/python3.8 -m pip install $PYTHON_INSTALL_OPTIONS $PYTHON_INSTALL_PACKAGES && \
188+
/usr/local/bin/python3.8 -m pip install $PYTHON_INSTALL_OPTIONS -r requirements.txt
189189

190190
## remove cache
191191
RUN echo "**** Cleaning python cache ****"
@@ -267,5 +267,5 @@ USER $USER
267267
EXPOSE 8000
268268

269269
## define cmd
270-
CMD [ "/usr/bin/python3.8", "-m", "mkdocs", "serve", "--verbose", "--dirtyreload", "--dev-addr=0.0.0.0:8000" ]
270+
CMD [ "/usr/local/bin/python3.8", "-m", "mkdocs", "serve", "--verbose", "--dirtyreload", "--dev-addr=0.0.0.0:8000" ]
271271
## CMD [ "mkdocs", "serve", "--verbose", "--dirtyreload", "-a", "0.0.0.0:8000" ]

scripts/docker-build.sh

+30-21
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,38 @@ DOCKER_DIR="${BASE_DIR}/distribution/docker-images"
3535
# DOCKER_CMD stores docker command
3636
DOCKER_CMD=${DOCKER_CMD:-$(command -v docker 2>/dev/null || command -v podman 2>/dev/null || type -p docker)}
3737
# DOCKER_OPTS stores docker options
38-
DOCKER_OPTS=${DOCKER_OPTS:-"--shm-size=1G"}
38+
DOCKER_OPTS=${DOCKER_OPTS:-"--rm --progress plain --force-rm true --no-cache true --shm-size=1G"}
3939

4040
main() {
41-
echo 'Building docker container...'
42-
43-
# docker file tag
44-
local tag
45-
tag="$1"
46-
shift
47-
48-
# Build docker image
49-
$DOCKER_CMD build \
50-
--rm \
51-
--force-rm true \
52-
--no-cache true \
53-
$DOCKER_OPTS \
54-
"${@:1}" \
55-
--file "${DOCKER_DIR}/${tag}.Dockerfile" \
56-
--tag "${IMAGE_REPOSITORY}:${IMAGE_TAG}" \
57-
--tag "${IMAGE_REPOSITORY}:${GIT_SHA}" \
58-
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
59-
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \
60-
"$BASE_DIR"
41+
echo 'Building docker container...'
42+
43+
# docker file tag
44+
local tag
45+
tag="$1"
46+
shift
47+
48+
# docker architecture
49+
local architecture
50+
architecture="$1"
51+
shift
52+
53+
case "$architecture" in
54+
amd64) platform="linux/amd64" ;;
55+
arm64) platform="linux/arm64" ;;
56+
armhf) platform="linux/arm/7" ;;
57+
esac
58+
59+
# Build docker image
60+
$DOCKER_CMD build \
61+
--platform "$platform" \
62+
$DOCKER_OPTS \
63+
"${@:2}" \
64+
--file "${DOCKER_DIR}/${tag}.Dockerfile" \
65+
--tag "${IMAGE_REPOSITORY}:${IMAGE_TAG}" \
66+
--tag "${IMAGE_REPOSITORY}:${GIT_SHA}" \
67+
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
68+
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \
69+
"$BASE_DIR"
6170
}
6271

6372
[[ "$0" == "$BASH_SOURCE" ]] && main "$@"

scripts/docker-rebuild.sh

+31-22
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,42 @@ DOCKER_DIR="${BASE_DIR}/distribution/docker-images"
3535
# DOCKER_CMD stores docker command
3636
DOCKER_CMD=${DOCKER_CMD:-$(command -v docker 2>/dev/null || command -v podman 2>/dev/null || type -p docker)}
3737
# DOCKER_OPTS stores docker options
38-
DOCKER_OPTS=${DOCKER_OPTS:-"--shm-size=1G"}
38+
DOCKER_OPTS=${DOCKER_OPTS:-"--rm --progress plain --force-rm true --no-cache true --shm-size=1G"}
3939

4040
main() {
41-
echo ">>> Rebuilding docker container..."
41+
echo ">>> Rebuilding docker container..."
4242

43-
# docker file tag
44-
local tag
45-
tag="$1"
43+
# docker file tag
44+
local tag
45+
tag="$1"
46+
shift
4647

47-
# docker file path
48-
local file
49-
file="${DOCKER_DIR}/${tag}.Dockerfile"
48+
# docker architecture
49+
local architecture
50+
architecture="$1"
51+
shift
5052

51-
# Build docker image
52-
$DOCKER_CMD build \
53-
--rm \
54-
--force-rm true \
55-
--no-cache true \
56-
$DOCKER_OPTS \
57-
"${@:1}" \
58-
--file "$file" \
59-
--tag "${IMAGE_REPOSITORY}:${IMAGE_TAG}" \
60-
--tag "${IMAGE_REPOSITORY}:${GIT_SHA}" \
61-
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
62-
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \
63-
--no-cache=true \
64-
"$BASE_DIR"
53+
# docker file path
54+
local file
55+
file="${DOCKER_DIR}/${tag}.Dockerfile"
56+
57+
case "$architecture" in
58+
amd64) platform="linux/amd64" ;;
59+
arm64) platform="linux/arm64" ;;
60+
armhf) platform="linux/arm/7" ;;
61+
esac
62+
63+
# Build docker image
64+
$DOCKER_CMD build \
65+
--platform "$platform" \
66+
$DOCKER_OPTS \
67+
"${@:2}" \
68+
--file "$file" \
69+
--tag "${IMAGE_REPOSITORY}:${IMAGE_TAG}" \
70+
--tag "${IMAGE_REPOSITORY}:${GIT_SHA}" \
71+
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
72+
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \
73+
"$BASE_DIR"
6574
}
6675

6776
[[ "$0" == "$BASH_SOURCE" ]] && main "$@"

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
'Operating System :: MacOS :: MacOS X',
5656
'Programming Language :: Python :: 3',
5757
'License :: OSI Approved :: GPL-3.0 License',
58+
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv2+)',
5859
'Natural Language :: English',
5960
'Topic :: Utilities',
6061
],

0 commit comments

Comments
 (0)