added air for debugging containers

This commit is contained in:
Marvin Zhang
2021-11-20 11:30:55 +08:00
parent 3b5119e055
commit fa4dc4b0f8
7 changed files with 132 additions and 88 deletions

View File

@@ -1,26 +1,40 @@
FROM golang:buster
FROM golang:1.16
RUN go env -w GOPROXY=https://goproxy.io,https://goproxy.cn && \
go env -w GO111MODULE="on"
WORKDIR /tools
RUN go get github.com/cosmtrek/air
WORKDIR /backend
RUN rm -rf /tools
# set as non-interactive
ENV DEBIAN_FRONTEND noninteractive
# set CRAWLAB_IS_DOCKER
ENV CRAWLAB_IS_DOCKER Y
# install packages
RUN chmod 777 /tmp \
&& sed -i 's#http://deb.debian.org#https://mirrors.tuna.tsinghua.edu.cn#g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y curl net-tools iputils-ping ntp ntpdate python3 python3-pip dumb-init \
&& apt-get install -y curl git net-tools iputils-ping ntp ntpdate nginx wget dumb-init cloc
# install python
RUN apt-get install -y python3 python3-pip \
&& ln -s /usr/bin/pip3 /usr/local/bin/pip \
&& ln -s /usr/bin/python3 /usr/local/bin/python
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# install golang
RUN curl -OL https://storage.googleapis.com/golang/go1.16.7.linux-amd64.tar.gz \
&& tar -C /usr/local -xvf go1.16.7.linux-amd64.tar.gz \
&& ln -s /usr/local/go/bin/go /usr/local/bin/go
# install seaweedfs
RUN wget https://github.com/chrislusf/seaweedfs/releases/download/2.76/linux_amd64.tar.gz \
&& tar -zxf linux_amd64.tar.gz \
&& cp weed /usr/local/bin
# install backend
RUN pip install scrapy pymongo bs4 requests crawlab-sdk scrapy-splash
RUN mkdir /spiders && chmod -R 0755 /spiders
RUN pip install scrapy pymongo bs4 requests -i https://mirrors.aliyun.com/pypi/simple
RUN pip install crawlab-sdk==0.6.b20211024-1207
VOLUME /backend
EXPOSE 8080