Change base image

This commit is contained in:
Patrick Jentsch 2019-11-29 15:08:16 +01:00
parent 1c9e715980
commit 6db99cfba5
3 changed files with 32 additions and 51 deletions

View File

@ -1,32 +1,35 @@
FROM python:3.6-alpine
EXPOSE 5000
FROM python:3.6-slim-stretch
ENV FLASK_APP=opaque.py
RUN apk add \
bash \
build-base \
git \
postgresql-dev
RUN apt-get update \
&& apt-get install --no-install-recommends --yes \
build-essential \
libpq-dev \
wait-for-it \
&& rm -rf /var/lib/apt/lists/*
RUN adduser -D opaque
RUN groupadd --gid 1000 --system opaque \
&& useradd --create-home --gid opaque --no-log-init --system --uid 1000 opaque
USER opaque
WORKDIR /home/opaque
COPY app app
COPY migrations migrations
COPY config.py opaque.py requirements.txt ./
RUN python -m venv venv && \
venv/bin/pip install -r requirements.txt
COPY ["app", "app"]
COPY ["migrations", "migrations"]
COPY ["tests", "tests"]
COPY ["config.py", "opaque.py", "requirements.txt", "./"]
RUN python -m venv venv \
&& venv/bin/pip install --requirement requirements.txt \
&& mkdir logs
# add wait for it
RUN git clone https://github.com/vishnubob/wait-for-it.git
COPY docker-entrypoint.sh /usr/local/bin/
EXPOSE 5000
VOLUME ["/home/opaque/logs", "/home/opaque/migrations"]
COPY ["docker-entrypoint.sh", "/usr/local/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"]

View File

@ -5,10 +5,6 @@ services:
depends_on:
- db
- redis
deploy:
placement:
constraints:
- node.role == manager
env_file:
- db.env
- web.env
@ -16,52 +12,34 @@ services:
ports:
- 5000:5000
volumes:
- storage:/mnt/opaque
- /mnt/opaque:/mnt/opaque
- ./app:/home/opaque/app
- ./config.py:/home/opaque/config.py
- ./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- ./logs:/home/opaque/logs
- ./migrations:/home/opaque/migrations
- ./tests:/home/opaque/tests
- ./config.py:/home/opaque/config.py
- ./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- ./opaque.py:/home/opaque/opaque.py
- ./requirements.txt:/home/opaque/requirements.txt
daemon:
depends_on:
- db
deploy:
placement:
constraints:
- node.role == manager
env_file:
- db.env
- web.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
volumes:
- storage:/mnt/opaque
- /mnt/opaque:/mnt/opaque
- ./logs:/home/opaque_daemon/logs
- ../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- ../opaque_daemon/opaque_daemon.py:/home/opaque_daemon/opaque_daemon.py
- ../opaque_daemon/merge_corpus_files.py:/home/opaque_daemon/merge_corpus_files.py
- ../opaque_daemon/config.ini:/home/opaque_daemon/config.ini
- ../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- ../opaque_daemon/requirements.txt:/home/opaque_daemon/requirements.txt
- $HOME/.docker/config.json:/home/opaque_daemon/.docker/config.json
db:
deploy:
placement:
constraints:
- node.role == manager
env_file: db.env
image: postgres:11-alpine
volumes:
- /srv/opaque/database:/var/lib/postgresql/data
redis:
deploy:
placement:
constraints:
- node.role == manager
image: redis:alpine
volumes:
storage:
driver: local
driver_opts:
device: "//127.0.0.1/opaque_storage"
o: "gid=1000,password=opaque,uid=1000,username=opaque"
type: cifs

View File

@ -1,9 +1,9 @@
#!/bin/sh
#!/bin/bash
echo "Waiting for db..."
wait-for-it/wait-for-it.sh db:5432 --strict --timeout=0
wait-for-it db:5432 --strict --timeout=0
echo "Waiting for redis..."
wait-for-it/wait-for-it.sh redis:6379 --strict --timeout=0
wait-for-it redis:6379 --strict --timeout=0
if [ $# -eq 0 ]
then