Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile warning #2811

Closed
2 tasks done
mehrdadbn9 opened this issue Jul 22, 2024 · 3 comments
Closed
2 tasks done

Dockerfile warning #2811

mehrdadbn9 opened this issue Jul 22, 2024 · 3 comments
Labels

Comments

@mehrdadbn9
Copy link
Contributor

Prerequisites

Description

default Docker file at build time have warnings as shown below

if it is possible to contribute i am willing to be assigned and become contributor as well

Screenshot from 2024-07-22 17-03-38

can use below one to fix it

# Stage 1: Build web front end
FROM node:18.0.0-alpine AS webui-builder

ADD locust/webui locust/webui
ADD package.json .

# long yarn timeout necessary in certain network environments
RUN yarn webui:install --production --network-timeout 60000
RUN yarn webui:build

# Stage 2: Build Locust package
FROM python:3.11-slim AS base

FROM base AS builder
RUN apt-get update && apt-get install -y git 
# there are no wheels for some packages (geventhttpclient?) for arm64/aarch64, so we need some build dependencies there
RUN if [ -n "$(arch | grep 'arm64\|aarch64')" ]; then apt install -y --no-install-recommends gcc python3-dev; fi
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENV SKIP_PRE_BUILD="true"
COPY . /build
WORKDIR /build
# bring in the prebuilt front-end before package installation
COPY --from=webui-builder locust/webui/dist locust/webui/dist
RUN pip install poetry && \
    poetry config virtualenvs.create false && \
    poetry self add "poetry-dynamic-versioning[plugin]" && \
    poetry build -f wheel && \
    pip install dist/*.whl

# Stage 3: Runtime image
FROM base
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# turn off python output buffering
ENV PYTHONUNBUFFERED=1
RUN useradd --create-home locust
# ensure correct permissions
RUN chown -R locust /opt/venv
USER locust
WORKDIR /home/locust
EXPOSE 8089 5557
ENTRYPOINT ["locust"]

Command line

docker build -t locust .

Locustfile contents

default one!

Python version

3.11

Locust version

latest

Operating system

22.04

@mehrdadbn9 mehrdadbn9 added the bug label Jul 22, 2024
@cyberw
Copy link
Collaborator

cyberw commented Jul 22, 2024

Good catch!

Fork the repo, make a branch and then open PR to our master branch and I’ll accept it!

@mehrdadbn9
Copy link
Contributor Author

appreciate your kindness i will do that

@JavierUhagon
Copy link
Contributor

@cyberw

Hey there, #2814 fixed this, right? Would be awesome to get this closed :)

@cyberw cyberw closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants