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

Docker 报错~!~!(后端) #44

Open
oemsys opened this issue Apr 24, 2023 · 2 comments
Open

Docker 报错~!~!(后端) #44

oemsys opened this issue Apr 24, 2023 · 2 comments

Comments

@oemsys
Copy link

oemsys commented Apr 24, 2023

root@Unraid:/mnt/user/appdata/jiezhang-back-open/docker# docker build -t jz -f ./Dockerfile .
Sending build context to Docker daemon 19.46kB
Step 1/12 : From ruby:2.3.1
---> ffe8239a147c
Step 2/12 : ENV RAILS_ROOT /home/ljt
---> Running in ba7c2ab988b1
Removing intermediate container ba7c2ab988b1
---> 67c94f5a29d7
Step 3/12 : WORKDIR $RAILS_ROOT
---> Running in 3b49fd5fe860
Removing intermediate container 3b49fd5fe860
---> cec469b2a217
Step 4/12 : RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list && echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list && echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
---> Running in 5dde893e10c3
Removing intermediate container 5dde893e10c3
---> 98f42f082977
Step 5/12 : RUN apt-get update -qq && apt-get install -y build-essential vim nodejs npm python-setuptools python-docutils build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev vim python imagemagick libmagickcore-dev imagemagick-common libmagickwand-dev sudo ntpdate snmpd snmp libpng-dev libjpeg-dev rsync tk libpcre3-dev libmysqlclient-dev mysql-client autoconf automake gettext libpq-dev cmake redis-server
---> Running in 9155f9450e76

W: Failed to fetch http://mirrors.163.com/debian/dists/jessie/InRelease

W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/InRelease

W: Failed to fetch http://mirrors.163.com/debian/dists/jessie/Release.gpg Unable to connect to mirrors.163.com:http:

W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/Release.gpg Unable to connect to mirrors.163.com:http:

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package gettext is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package cmake is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package rsync is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package build-essential
E: Unable to locate package vim
E: Unable to locate package nodejs
E: Unable to locate package npm
E: Unable to locate package python-setuptools
E: Unable to locate package python-docutils
E: Unable to locate package build-essential
E: Unable to locate package libgdbm-dev
E: Unable to locate package openssh-server
E: Unable to locate package checkinstall
E: Unable to locate package libicu-dev
E: Unable to locate package vim
E: Unable to locate package sudo
E: Unable to locate package ntpdate
E: Unable to locate package snmpd
E: Unable to locate package snmp
E: Package 'rsync' has no installation candidate
E: Unable to locate package tk
E: Unable to locate package mysql-client
E: Package 'gettext' has no installation candidate
E: Package 'cmake' has no installation candidate
E: Unable to locate package redis-server

@yigger
Copy link
Owner

yigger commented Jun 7, 2023

看起来源出了问题~

@yigger
Copy link
Owner

yigger commented Jun 7, 2023

把 Dockerfile 改为用下面这段代码试试

FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

# 基础设施
RUN  cp /etc/apt/sources.list /etc/apt/sources.list.bak \
    && sed 's/archive\.ubuntu\.com/mirrors\.163\.com/' /etc/apt/sources.list.bak | tee /etc/apt/sources.list \
    && apt-get update \
    && apt-get -y install apt-utils locales gnupg \
    && apt-get -y upgrade \
    && rm -rf /var/lib/apt/lists/* \
    && locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 \
    LANGUAGE=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8

RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean \
    && apt-get update \
    && apt-get -y install \
    sudo git gcc vim curl openssh-server redis-server nginx cmake \
    libsodium-dev zlib1g-dev libgdbm-dev libncurses5-dev libffi-dev \
    checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev imagemagick libmagickcore-dev \
    imagemagick-common libmagickwand-dev ntpdate snmpd snmp libpng-dev libjpeg-dev rsync tk libpcre3-dev \
    libmysqlclient-dev mysql-client automake gettext unzip openssl libreadline-dev zlib1g libssl-dev \
    libyaml-dev autoconf libc6-dev ncurses-dev libtool bison build-essential libsqlite3-dev sqlite3 \
    libxslt1-dev python3 python3-pip python3-docutils python3-software-properties fonts-wqy-zenhei \
    libexpat1-dev libz-dev less libjemalloc-dev \
    && rm -rf /var/lib/apt/lists/*

RUN sed -i 's/127.0.0.1/0.0.0.0/g' /etc/redis/redis.conf

# ruby2.6.8版本安装
ADD ./ruby-2.6.8.tar.gz /tmp/src/
RUN cd /tmp/src/ruby-2.6.8 \
    && ./configure --enable-rpath --enable-shared --disable-install-doc --disable-install-rdoc --with-jemalloc \
    && make -j4 \
    && make install \
    && rm -rf /tmp/src

# yarn/npm
ADD ./node-v14.16.1-linux-x64.tar.gz /opt
ENV PATH="/opt/node-v14.16.1-linux-x64/bin:${PATH}"
RUN npm install --global yarn

ADD ./docker-entrypoint.sh /usr/local/bin/
# Nginx 配置文件
ADD ./jiezhang-back.conf /etc/nginx/conf.d/
# 新增 jz 角色
RUN adduser jz --disabled-login --gecos 'jz' \
    && usermod -a -G sudo jz \
    && echo "jz  ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
# 切换到 jz
USER jz
# 更换 ruby 源到 ruby-china
RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ \
    && sudo gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ \
    && bundle config set --local path 'vendor/bundle' \
    && sudo gem install bundler

VOLUME ["/home/jz/jiezhang-back"]
WORKDIR /home/jz/jiezhang-back
EXPOSE 22 80 443 3000
# ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/bin/sh"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants