Skip to content

Instantly share code, notes, and snippets.

@andreasvc
Created September 8, 2020 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasvc/4477ddc3be2eddfb7e41df417dff10a0 to your computer and use it in GitHub Desktop.
Save andreasvc/4477ddc3be2eddfb7e41df417dff10a0 to your computer and use it in GitHub Desktop.
docker-compose example
version: '3'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2
# # Enables the web UI and tells Traefik to listen to docker
# command: --api.insecure=true --providers.docker
# Tells Traefik to listen to docker
command: --providers.docker
ports:
# The HTTP port
- "5080:80"
# The Web UI (enabled by --api.insecure=true)
# - "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
whoami:
# A container that exposes an API to show its IP address
image: containous/whoami
labels:
- "traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)"
helloworld:
image: karthequian/helloworld
labels:
- "traefik.http.routers.helloworld.rule=PathPrefix(`/hello`)"
- "traefik.http.routers.helloworld.middlewares=strip-helloworld-prefix@docker"
- "traefik.http.middlewares.strip-helloworld-prefix.stripprefix.prefixes=/hello"
parser:
build: parser/
ports:
- "5000:5000"
labels:
- "traefik.http.routers.parser.rule=PathPrefix(`/parser`)"
# This is a comment
FROM ubuntu:20.04
MAINTAINER Andreas van Cranenburgh <a.w.vancranenburgh@uva.nl>
RUN ln -fs /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
python3 \
python3-dev \
python3-pip \
python3-numpy \
python3-scipy \
python3-pandas \
&& apt-get clean
RUN groupadd --system user && useradd --system --create-home --gid user user
WORKDIR /home/user
RUN git clone --recursive https://github.com/andreasvc/disco-dop.git
WORKDIR /home/user/disco-dop
RUN pip3 install \
--requirement requirements.txt \
--requirement web/requirements.txt \
&& python3 setup.py install \
&& mkdir web/grammars
WORKDIR /home/user/disco-dop/web/grammars
RUN for a in de_tiger en_ptb fr_ftb nl_cgn nl_lassy; do \
curl -sSL https://staff.fnwi.uva.nl/a.w.vancranenburgh/grammars/$a.tar | \
tar -xf - ; \
done
USER user
WORKDIR /home/user/disco-dop/web
CMD ["python3", "parse.py"]
EXPOSE 5000
@andreasvc
Copy link
Author

Run with docker-compose up -d
Stop with docker-compose down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment