Correct issue on the dev Docker

pull/2135/head
nicolargo 2022-09-15 11:02:11 +02:00
parent fdbbf94b46
commit 2532008162
4 changed files with 42 additions and 56 deletions

View File

@ -108,6 +108,15 @@ flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
rm -rf ./flatpak-builder-tools rm -rf ./flatpak-builder-tools
@echo "Now follow: https://github.com/flathub/flathub/wiki/App-Submission" @echo "Now follow: https://github.com/flathub/flathub/wiki/App-Submission"
# ===================================================================
# Docker
# ===================================================================
docker:
docker build --target full -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-full .
docker build --target minimal -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-minimal .
docker build --target dev -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-dev .
# =================================================================== # ===================================================================
# Run # Run
# =================================================================== # ===================================================================
@ -121,6 +130,15 @@ run-debug: ## Start Glances in debug console mode (also called standalone)
run-local-conf: ## Start Glances in console mode with the system conf file run-local-conf: ## Start Glances in console mode with the system conf file
./venv/bin/python -m glances ./venv/bin/python -m glances
run-docker-alpine-minimal: ## Start Glances Alpine Docker minimal in console mode
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-minimal
run-docker-alpine-full: ## Start Glances Alpine Docker full in console mode
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-full
run-docker-alpine-dev: ## Start Glances Alpine Docker dev in console mode
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev
run-webserver: ## Start Glances in Web server mode run-webserver: ## Start Glances in Web server mode
./venv/bin/python -m glances -C ./conf/glances.conf -w ./venv/bin/python -m glances -C ./conf/glances.conf -w

View File

@ -1,38 +1,11 @@
# Dockerfiles # Dockerfiles
The Dockerfiles used here are using multi-staged builds. ```bash
For building a specific stage locally docker needs to know the target stage with `--target`. make docker
```
## Examples for Debian images Then test the image with:
For the dev image: ```bash
``bash make run-docker-alpine-dev
docker build --target dev -f ./docker-files/debian.Dockerfile -t glances:dev . ```
``
For the minimal image:
``bash
docker build --target minimal -f ./docker-files/debian.Dockerfile -t glances:minimal .
``
For the full image:
``bash
docker build --target full -f ./docker-files/debian.Dockerfile -t glances:full .
``
## Examples for Alpine images
For the dev image:
``bash
docker build --target dev -f ./docker-files/alpine.Dockerfile -t glances:dev .
``
For the minimal image:
``bash
docker build --target minimal -f ./docker-files/alpine.Dockerfile -t glances:minimal .
``
For the full image:
``bash
docker build --target full -f ./docker-files/alpine.Dockerfile -t glances:full .
``

View File

@ -37,7 +37,7 @@ RUN pip3 install --no-cache-dir --user -r requirements.txt
# Force install otherwise it could be cached without rerun # Force install otherwise it could be cached without rerun
ARG CHANGING_ARG ARG CHANGING_ARG
RUN pip3 install --no-cache-dir --user glances[all] RUN pip3 install --no-cache-dir --user "glances[all]"
FROM build as additional-packages FROM build as additional-packages
@ -48,16 +48,15 @@ COPY *requirements.txt ./
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
############################################################################## ##############################################################################
# dev image # full image
############################################################################## ##############################################################################
FROM build as dev FROM build as full
ARG PYTHON_VERSION ARG PYTHON_VERSION
COPY --from=remoteInstall /root/.local/bin /usr/local/bin/ COPY --from=remoteInstall /root/.local/bin /usr/local/bin/
COPY --from=remoteInstall /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/ COPY --from=remoteInstall /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=additional-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/ COPY --from=additional-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY . /glances
COPY ./docker-compose/glances.conf /etc/glances.conf COPY ./docker-compose/glances.conf /etc/glances.conf
# EXPOSE PORT (XMLRPC / WebUI) # EXPOSE PORT (XMLRPC / WebUI)
@ -72,7 +71,7 @@ CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
# minimal image # minimal image
############################################################################## ##############################################################################
#Create running images without any building dependency # Create running images without any building dependency
FROM alpine:${IMAGE_VERSION} as minimal FROM alpine:${IMAGE_VERSION} as minimal
ARG PYTHON_VERSION ARG PYTHON_VERSION
@ -94,17 +93,8 @@ EXPOSE 61209
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
############################################################################## ##############################################################################
# full image # dev image (=full)
############################################################################## ##############################################################################
FROM minimal as full FROM full as dev
ARG PYTHON_VERSION
COPY --from=additional-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT

View File

@ -34,7 +34,7 @@ RUN pip3 install --no-cache-dir --user -r requirements.txt
# Force install otherwise it could be cached without rerun # Force install otherwise it could be cached without rerun
ARG CHANGING_ARG ARG CHANGING_ARG
RUN pip3 install --no-cache-dir --user glances[all] RUN pip3 install --no-cache-dir --user "glances[all]"
FROM build as additional-packages FROM build as additional-packages
@ -45,10 +45,10 @@ COPY *requirements.txt ./
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt
############################################################################## ##############################################################################
# dev image # full image
############################################################################## ##############################################################################
FROM build as dev FROM build as full
ARG PYTHON_VERSION ARG PYTHON_VERSION
COPY --from=remoteInstall /root/.local/bin /usr/local/bin/ COPY --from=remoteInstall /root/.local/bin /usr/local/bin/
@ -93,17 +93,22 @@ EXPOSE 61209
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
############################################################################## ##############################################################################
# full image # dev image (=full)
############################################################################## ##############################################################################
FROM minimal as full FROM build as dev
ARG PYTHON_VERSION ARG PYTHON_VERSION
COPY --from=additional-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/local/lib/python${PYTHON_VERSION}/site-packages/ COPY --from=remoteInstall /root/.local/bin /usr/local/bin/
COPY --from=remoteInstall /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=additional-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf COPY ./docker-compose/glances.conf /etc/glances.conf
# EXPOSE PORT (XMLRPC / WebUI) # EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208 EXPOSE 61209 61208
WORKDIR /glances
# Define default command. # Define default command.
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT