Skip to content

Commit

Permalink
Create docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
charalamm committed Aug 14, 2023
1 parent 3b28c08 commit ba67a6f
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
.venv
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.gitignore
.github
.gitattributes
*.egg-info
.mypy_cache
.pytest_cache
.hypothesis
build
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
IMAGE=terracotta
VERSION=<>

all: build push

build:
docker build -f ./docker/Dockerfile -t $(IMAGE):$(VERSION) .

push:
docker push $(IMAGE):$(VERSION)

.PHONY: build push all
32 changes: 32 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.10.12-slim-bullseye as build_tarball

RUN apt-get update \
&& apt-get install \
-y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*

COPY ./ /terracotta
COPY ./docker/entrypoint.sh /entrypoint.sh

WORKDIR /terracotta

RUN python -m pip install --upgrade pip \
&& python setup.py sdist


FROM python:3.10.12-slim-bullseye

COPY --from=build_tarball /terracotta/dist/terracotta-*.tar.gz /terracotta/terracotta.tar.gz
COPY --from=build_tarball /entrypoint.sh /entrypoint.sh

RUN pip install --upgrade pip \
&& pip install psycopg2-binary \
&& pip install /terracotta/terracotta.tar.gz \
&& rm -rf /terracotta

ENV TC_SERVER_PORT=5000
EXPOSE $TC_SERVER_PORT

CMD ["/entrypoint.sh"]
3 changes: 3 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

terracotta serve --allow-all-ips --port $TC_SERVER_PORT -d $TC_DRIVER_PATH

0 comments on commit ba67a6f

Please sign in to comment.