Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Template for index.html
- index: path.resolve(__dirname, '../../dist/index.html'), // /alpine/dist
- // Paths
- assetsRoot: path.resolve(__dirname, '../../dist'), // /alpine/dist
- from alpine.utils import get_base_path, listfiles
- logger.info(os.path.join(get_base_path(), 'dist')) # /alpine/dist
- logger.info(listfiles(os.path.join(get_base_path(), 'dist'))) # /alpine/dist
- import os
- def listfiles(path):
- return [_ for _ in os.listdir(path) if os.path.isfile(os.path.join(path, _))]
- def get_base_path():
- current_directory_path = os.path.realpath(os.path.dirname(__file__))
- base_path = os.path.split(os.path.split(current_directory_path)[0])[0]
- return base_path
- FROM python:3.6
- ENV INSTALL_PATH /alpine
- ENV ALPINE_USER alpine
- RUN apt-get update && apt-get -y install sudo
- RUN adduser --disabled-password --gecos '' $ALPINE_USER
- RUN mkdir -p $INSTALL_PATH
- WORKDIR $INSTALL_PATH
- RUN wget -O nodejs.sh https://deb.nodesource.com/setup_8.x
- && bash ./nodejs.sh
- && apt-get install -y nodejs
- && apt-get install -y build-essential
- && rm ./nodejs.sh
- COPY requirements.txt requirements.txt
- RUN pip install -r requirements.txt
- COPY js/build js/build
- COPY js/config js/config
- COPY js/package-lock.json js/package-lock.json
- COPY js/package.json js/package.json
- WORKDIR $INSTALL_PATH/js
- RUN npm install
- WORKDIR $INSTALL_PATH
- COPY js js
- WORKDIR $INSTALL_PATH/js
- RUN npm run build
- WORKDIR $INSTALL_PATH
- COPY . .
- RUN cp config/config.yml.template config/config.yml
- RUN echo $INSTALL_PATH
- RUN ls -la $INSTALL_PATH
- RUN echo $INSTALL_PATH/dist
- RUN ls -la $INSTALL_PATH/dist
- CMD sudo -u $ALPINE_USER python manage.py api run
- version: '2'
- services:
- api:
- build: .
- volumes:
- - '.:/alpine'
- ports:
- - '8000:8000'
- links:
- - postgres:postgres
- postgres:
- image: 'postgres:10'
- volumes:
- - './tmp/postgres:/var/lib/postgresql/data'
- ports:
- - '5432:5432'
- environment:
- - POSTGRES_PASSWORD=password
- - POSTGRES_USER=alpine
- - POSTGRES_DB=alpine
- Step 25/29 : RUN echo $INSTALL_PATH
- ---> Running in a62b3fa4ce75
- /alpine
- ---> 993396566775
- Removing intermediate container a62b3fa4ce75
- Step 26/29 : RUN ls -la $INSTALL_PATH
- ---> Running in 1a2688436868
- total 80
- drwxr-xr-x 15 root root 4096 Feb 8 15:14 .
- drwxr-xr-x 85 root root 4096 Feb 8 15:14 ..
- -rw-r--r-- 1 root root 1026 Feb 8 15:13 Dockerfile
- -rw-r--r-- 1 root root 0 Aug 17 06:06 README.md
- -rw-r--r-- 1 root root 0 Aug 17 06:04 __init__.py
- drwxr-xr-x 2 root root 4096 Feb 8 15:14 config
- drwxr-xr-x 3 root root 4096 Feb 8 04:22 dist
- -rw-r--r-- 1 root root 379 Feb 8 15:13 docker-compose.yml
- drwxr-xr-x 17 root root 4096 Feb 7 19:20 js
- -rw-r--r-- 1 root root 319 Oct 2 19:19 manage.py
- drwxr-xr-x 4 root root 4096 Oct 10 19:01 migrations
- drwxr-xr-x 8 root root 4096 Jan 9 16:31 alpine
- -rw-r--r-- 1 root root 738 Feb 7 17:04 requirements.txt
- ---> 634ae19fd35c
- Removing intermediate container 1a2688436868
- Step 27/29 : RUN echo $INSTALL_PATH/dist
- ---> Running in 2134107ac398
- /alpine/dist
- ---> 4a692f89324f
- Removing intermediate container 2134107ac398
- Step 28/29 : RUN ls -la $INSTALL_PATH/dist
- ---> Running in 06d954f83c8f
- total 16
- drwxr-xr-x 3 root root 4096 Feb 8 04:22 .
- drwxr-xr-x 15 root root 4096 Feb 8 15:14 ..
- -rw-r--r-- 1 root root 504 Feb 8 04:22 index.html
- drwxr-xr-x 4 root root 4096 Feb 8 04:22 static
- ---> 17378436f04c
- Removing intermediate container 06d954f83c8f
- Step 29/29 : CMD sudo -u $ALPINE_USER python manage.py api run
- ---> Running in 4952b6b65fc1
- ---> a3d3ac2d93dc
- Removing intermediate container 4952b6b65fc1
- Successfully built a3d3ac2d93dc
- Successfully tagged alpine_api:latest
- Starting alpine_postgres_1 ...
- Starting alpine_postgres_1 ... done
- Recreating alpine_api_1 ...
- Recreating alpine_api_1 ... done
- Attaching to alpine_postgres_1, alpine_api_1
- postgres_1 | 2018-02-08 15:14:25.483 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
- postgres_1 | 2018-02-08 15:14:25.483 UTC [1] LOG: listening on IPv6 address "::", port 5432
- postgres_1 | 2018-02-08 15:14:25.521 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
- postgres_1 | 2018-02-08 15:14:25.598 UTC [23] LOG: database system was shut down at 2018-02-08 15:13:20 UTC
- postgres_1 | 2018-02-08 15:14:25.627 UTC [1] LOG: database system is ready to accept connections
- api_1 | 2018-02-08 15:14:26,601 - alpine.app/_init_sanic - INFO - /alpine/dist
- api_1 | Traceback (most recent call last):
- api_1 | File "manage.py", line 19, in <module>
- api_1 | cli()
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
- api_1 | return self.main(*args, **kwargs)
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
- api_1 | rv = self.invoke(ctx)
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
- api_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
- api_1 | return _process_result(sub_ctx.command.invoke(sub_ctx))
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
- api_1 | return ctx.invoke(self.callback, **ctx.params)
- api_1 | File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
- api_1 | return callback(*args, **kwargs)
- api_1 | File "/alpine/alpine/cli/api.py", line 55, in run
- api_1 | app = AlpineApp(config_path=config_path)
- api_1 | File "/alpine/alpine/app.py", line 80, in __init__
- api_1 | self._init_sanic()
- api_1 | File "/alpine/alpine/app.py", line 89, in _init_sanic
- api_1 | logger.info(listfiles(os.path.join(get_base_path(), 'dist')))
- api_1 | File "/alpine/alpine/utils/__init__.py", line 42, in listfiles
- api_1 | return [_ for _ in os.listdir(path) if os.path.isfile(os.path.join(path, _))]
- api_1 | FileNotFoundError: [Errno 2] No such file or directory: '/alpine/dist'
- alpine_api_1 exited with code 1
- 2018-02-08 15:34:34,920 - alpine.app/_init_sanic - INFO - /alpine/dist
- 2018-02-08 15:34:34,921 - alpine.app/_init_sanic - INFO - ['index.html']
- [2018-02-08 15:34:35 +0000] [1] [INFO] Goin' Fast @ http://0.0.0.0:8000
- 2018-02-08 15:34:35,126 - alpine.app/setup_db - INFO - [postgres] starting...
- 2018-02-08 15:34:35,130 - alpine.app/setup_db - INFO - [postgres] starting...
- 2018-02-08 15:34:35,133 - alpine.app/setup_db - INFO - [postgres] starting...
- 2018-02-08 15:34:35,142 - alpine.app/setup_db - INFO - [postgres] starting...
Add Comment
Please, Sign In to add comment