Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(docker): add buster image with minimum dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 12, 2019
1 parent da1bbc0 commit 6aab48c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
23 changes: 7 additions & 16 deletions Dockerfiles/buster.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
FROM python:3.7.4-slim-buster AS dependency
FROM python:3.7.4-slim-buster AS base

WORKDIR /gnes/

COPY setup.py ./setup.py
ADD . ./

RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential g++ gfortran file binutils \
python3-dev cython libopenblas-dev && \
build-essential \
python3-dev libopenblas-dev && \
ln -s locale.h /usr/include/xlocale.h && \
python -c "import distutils.core;s=distutils.core.run_setup('setup.py').install_requires;f=open('requirements_tmp.txt', 'w');[f.write(v+'\n') for v in s];f.close()" && \
cat requirements_tmp.txt && \
pip install --no-cache-dir --compile -r requirements_tmp.txt && \
rm -rf /var/lib/apt/lists/* && \
pip install . --no-cache-dir --compile && \
rm -rf /tmp/* && rm -rf /gnes && \
apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm /usr/include/xlocale.h

FROM dependency as base

ADD . ./

RUN pip install . --no-cache-dir --compile && \
rm -rf /tmp/* && \
rm -rf /gnes

WORKDIR /

ENTRYPOINT ["gnes"]
21 changes: 21 additions & 0 deletions Dockerfiles/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:18.04 AS base

WORKDIR /gnes/

ADD . ./

RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
python3-dev python3-pip libopenblas-dev && \
ln -s locale.h /usr/include/xlocale.h && \
cd /usr/local/bin && \
ln -s /usr/bin/python3 python && \
pip3 install --upgrade pip && \
pip3 install . --no-cache-dir --compile && \
rm -rf /tmp/* && rm -rf /gnes && \
apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm /usr/include/xlocale.h

WORKDIR /

ENTRYPOINT ["gnes"]
10 changes: 5 additions & 5 deletions docker-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ _docker_push() {

_select_dockerfile() {
PS3='Please select the Dockerfile you want to build (type 1, 2, 3, ...): '
options=("Dockerfile" "alpine.Dockerfile" "buster.Dockerfile" "ubuntu.Dockerfile")
options=("full(~7.2GB)" "alpine(~300MB)" "buster(~800MB)" "ubuntu")
select opt in "${options[@]}"
do
case $opt in
"Dockerfile")
"full(~7.2GB)")
export DOCKER_FILE='Dockerfiles/full.Dockerfile'
export OS_TAG='full'
break
;;
"alpine.Dockerfile")
"alpine(~300MB)")
export DOCKER_FILE='Dockerfiles/alpine.Dockerfile'
export OS_TAG='alpine'
break
;;
"buster.Dockerfile")
"buster(~800MB)")
export DOCKER_FILE='Dockerfiles/buster.Dockerfile'
export OS_TAG='buster'
break
;;
"ubuntu.Dockerfile")
"ubuntu")
export DOCKER_FILE='Dockerfiles/ubuntu.Dockerfile'
export OS_TAG='ubuntu'
break
Expand Down

0 comments on commit 6aab48c

Please sign in to comment.