taigatakano commited on
Commit
824e702
·
1 Parent(s): 9b2b516

fix dockerfile

Browse files
Files changed (4) hide show
  1. .gitignore +0 -0
  2. Dockerfile +8 -4
  3. poetry.lock +0 -0
  4. run.sh +40 -0
.gitignore ADDED
File without changes
Dockerfile CHANGED
@@ -1,8 +1,12 @@
1
- FROM ubuntu:22.04
2
- RUN apt-get update && apt-get install -y curl
3
 
 
4
  RUN git config --global --add safe.directory /app
5
-
6
  RUN python3 -m pip install --upgrade pip
7
- RUN pip install poetry \
8
  && poetry config virtualenvs.create false
 
 
 
 
 
 
1
+ FROM python:3.10.15-slim-bullseye
 
2
 
3
+ RUN apt-get update && apt-get install -y git curl
4
  RUN git config --global --add safe.directory /app
 
5
  RUN python3 -m pip install --upgrade pip
6
+ RUN python3 -m pip install poetry \
7
  && poetry config virtualenvs.create false
8
+
9
+ WORKDIR /app
10
+ COPY pyproject.toml* poetry.lock* /app/
11
+ RUN poetry install
12
+ RUN rm -rf /app/pyproject.toml* /app/poetry.lock*
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
run.sh CHANGED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # https://qiita.com/k_ikasumipowder/items/5e71208b7c7ae3e4fe7c
4
+
5
+ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6
+
7
+ # Prevent running as root.
8
+ if [[ $(id -u) -eq 0 ]]; then
9
+ echo "This script cannot be executed with root privileges."
10
+ echo "Please re-run without sudo and follow instructions to configure docker for non-root user if needed."
11
+ exit 1
12
+ fi
13
+
14
+ # Check if user can run docker without root.
15
+ RE="\<docker\>"
16
+ if [[ ! $(groups $USER) =~ $RE ]]; then
17
+ echo "User |$USER| is not a member of the 'docker' group and cannot run docker commands without sudo."
18
+ echo "Run 'sudo usermod -aG docker \$USER && newgrp docker' to add user to 'docker' group, then re-run this script."
19
+ echo "See: https://docs.docker.com/engine/install/linux-postinstall/"
20
+ exit 1
21
+ fi
22
+
23
+ # Check if able to run docker commands.
24
+ if [[ -z "$(docker ps)" ]] ; then
25
+ echo "Unable to run docker commands. If you have recently added |$USER| to 'docker' group, you may need to log out and log back in for it to take effect."
26
+ echo "Otherwise, please check your Docker installation."
27
+ exit 1
28
+ fi
29
+
30
+ PLATFORM="$(uname -m)"
31
+
32
+ if [ $PLATFORM = "x86_64" ]; then
33
+ echo "x86"
34
+ docker build -t hoge .
35
+ # docker run -it --rm hoge /bin/bash
36
+ # docker pull ghcr.io/moriyalab/horus_inference_server:latest
37
+ docker run -it --rm -v $ROOT:/app -w /app --network host hoge /bin/bash
38
+ else
39
+ echo "Not Support Platform. Only support x86."
40
+ fi