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 FROM python:3.6-slim-stretch
EXPOSE 5000
ENV FLASK_APP=opaque.py ENV FLASK_APP=opaque.py
RUN apk add \ RUN apt-get update \
bash \ && apt-get install --no-install-recommends --yes \
build-base \ build-essential \
git \ libpq-dev \
postgresql-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 USER opaque
WORKDIR /home/opaque WORKDIR /home/opaque
COPY app app COPY ["app", "app"]
COPY migrations migrations COPY ["migrations", "migrations"]
COPY config.py opaque.py requirements.txt ./ COPY ["tests", "tests"]
RUN python -m venv venv && \ COPY ["config.py", "opaque.py", "requirements.txt", "./"]
venv/bin/pip install -r 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"] ENTRYPOINT ["docker-entrypoint.sh"]

View File

@ -5,10 +5,6 @@ services:
depends_on: depends_on:
- db - db
- redis - redis
deploy:
placement:
constraints:
- node.role == manager
env_file: env_file:
- db.env - db.env
- web.env - web.env
@ -16,52 +12,34 @@ services:
ports: ports:
- 5000:5000 - 5000:5000
volumes: volumes:
- storage:/mnt/opaque - /mnt/opaque:/mnt/opaque
- ./app:/home/opaque/app - ./app:/home/opaque/app
- ./config.py:/home/opaque/config.py
- ./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- ./logs:/home/opaque/logs - ./logs:/home/opaque/logs
- ./migrations:/home/opaque/migrations - ./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 - ./opaque.py:/home/opaque/opaque.py
- ./requirements.txt:/home/opaque/requirements.txt
daemon: daemon:
depends_on: depends_on:
- db - db
deploy:
placement:
constraints:
- node.role == manager
env_file: env_file:
- db.env - db.env
- web.env - web.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
volumes: volumes:
- storage:/mnt/opaque - /mnt/opaque:/mnt/opaque
- ./logs:/home/opaque_daemon/logs - ./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/opaque_daemon.py:/home/opaque_daemon/opaque_daemon.py
- ../opaque_daemon/merge_corpus_files.py:/home/opaque_daemon/merge_corpus_files.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/requirements.txt:/home/opaque_daemon/requirements.txt
- ../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh
- $HOME/.docker/config.json:/home/opaque_daemon/.docker/config.json - $HOME/.docker/config.json:/home/opaque_daemon/.docker/config.json
db: db:
deploy:
placement:
constraints:
- node.role == manager
env_file: db.env env_file: db.env
image: postgres:11-alpine image: postgres:11-alpine
volumes: volumes:
- /srv/opaque/database:/var/lib/postgresql/data - /srv/opaque/database:/var/lib/postgresql/data
redis: redis:
deploy:
placement:
constraints:
- node.role == manager
image: redis:alpine 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..." 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..." 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 ] if [ $# -eq 0 ]
then then