Reworking the container to use multistage builds. this should hopefully help it build faster
This commit is contained in:
parent
66aafc5433
commit
2533b907c1
@ -5,7 +5,6 @@ services:
|
|||||||
command: ["dockerd-entrypoint.sh"]
|
command: ["dockerd-entrypoint.sh"]
|
||||||
variables:
|
variables:
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- linting
|
- linting
|
||||||
@ -14,7 +13,7 @@ stages:
|
|||||||
linting:
|
linting:
|
||||||
stage: linting
|
stage: linting
|
||||||
before_script:
|
before_script:
|
||||||
- apk add --no-cache python3 python3-dev build-base docker g++ gcc libxml2-dev libxslt-dev python-dev libffi-dev openssl-dev make
|
- apk add --no-cache python3 python3-dev build-base docker g++ gcc libxml2-dev libxslt-dev libffi-dev openssl-dev make
|
||||||
- pip3 install pylint
|
- pip3 install pylint
|
||||||
- pip3 install -r app/requirements.txt
|
- pip3 install -r app/requirements.txt
|
||||||
script:
|
script:
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
FROM python:3.6-buster
|
FROM python:3.8 as build
|
||||||
RUN apt-get update && apt-get install -y gcc python-pip
|
RUN apt-get update && apt-get install -y gcc python-pip
|
||||||
|
# RUN apk add --no-cache build-base g++ gcc libxml2-dev libxslt-dev libffi-dev openssl-dev make
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN pip install -U pip && pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
FROM python:alpine
|
||||||
|
COPY --from=build /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/
|
||||||
ADD app /app
|
ADD app /app
|
||||||
CMD python /app/dragon-bot-updated.py
|
CMD python /app/dragon-bot-updated.py
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
FROM python:3.6-buster
|
FROM python:3.8 as builder
|
||||||
RUN apt-get update && apt-get install -y gcc python-pip vim
|
RUN apt-get update && apt-get install -y gcc python-pip
|
||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN pip install -U pip pylint && pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
ADD app /app
|
ADD app /app
|
||||||
#RUN printf "\n\nTesting your python code for errors\n\n" && \
|
#RUN printf "\n\nTesting your python code for errors\n\n" && \
|
||||||
# pylint -E /app/*.py
|
# pylint -E /app/*.py
|
||||||
@ -10,4 +9,4 @@ ADD app /app
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN printf "\n#########################\n Run dragon bot by typing \n python dragon-bot.py\n#########################\n\n"
|
RUN printf "\n#########################\n Run dragon bot by typing \n python dragon-bot.py\n#########################\n\n"
|
||||||
|
|
||||||
CMD python /app/dragon-bot.py
|
CMD python /app/dragon-bot-updated.py
|
||||||
|
@ -6,5 +6,4 @@ printf "[+] Done\n"
|
|||||||
printf "\n[-] Running dragon bot in test mode\n"
|
printf "\n[-] Running dragon bot in test mode\n"
|
||||||
docker build -f ./Dockerfile-test-env -t dragon-bot-test . || exit
|
docker build -f ./Dockerfile-test-env -t dragon-bot-test . || exit
|
||||||
|
|
||||||
# Run that shit and mount the docker socket so it can talk to the sky-factory container
|
|
||||||
docker run -ti --rm --name dragon-bot-test -e DRAGON_ENV=test -e token="MzQ1MjkwMTI5OTQ4Mjc4Nzg0.DG5IBw._9umb82PrL22bPe7GjmHClU-NtU" -v /var/run/docker.sock:/var/run/docker.sock dragon-bot-test sh
|
docker run -ti --rm --name dragon-bot-test -e DRAGON_ENV=test -e token="MzQ1MjkwMTI5OTQ4Mjc4Nzg0.DG5IBw._9umb82PrL22bPe7GjmHClU-NtU" -v /var/run/docker.sock:/var/run/docker.sock dragon-bot-test sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user