Skip to content

Commit a0b5d42

Browse files
committed
add multistage docker build
1 parent 582b63c commit a0b5d42

File tree

8 files changed

+14
-8
lines changed

8 files changed

+14
-8
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
- stage: docker
3333
env:
3434
- secure: "AqdVDfd4huBcPlB5hZ6aTrJxjcScRmTxkE/FeyHc+qY2rPu6tBLwHjYlr4FEXMovLsSvuO6GsxK2qbev6QLfma32HR08AMtLO5zm3DONCxA1zdYL3zYuwftInpzYpfUZri6G4zNpZJTeCFqEwyrWWCXVJyV4/ot2cgBKwuh2OtZfVqEyohs0Q2b5xQLBuJ14Di4lTbfRiVct8hcrdcRq19mp5Kvp8DD+8JtbAEWP0Qxi/+hDg0/IbxTMriqpfygSM+zxrGE0gOjgoUy+mlVFY6lV0UJ5GP4Vz4WEo6034FNOB0Lx4jRQmEBZatubeyrDQcBdtetbSrUAmf6UjT9BnWE3FPuiqoLJEB9SK+ohqNmLNl2uvg1mMnScNGBFs+HjOkxXvEtfzD1W0uQx1ueUh9qyvA3wkON568B9uE8QoEDoa3UkEv0U/ho/MzgQLmHlQkBZQR7yYOpzhNTLy+lYt7ZMnLs9JfKSDXzQ6xQI08/CoTrnc402POW/Y62d+eK7HS5mJVIxo1bD+jTtdlnLMM3OLgl1Qujd/7AYeuIqfSj/B39AlUVrWLWJ+smb+GqDk6ZTLYFqm7bpp7kiDNAYIV8vePXpwiOziHhgv+ht8/60379IpKZVZ7MeBT6CRN2LLaAjBzi3/NWte7Wg/lJP8n2kdKoFq9olMp1ii6iLYd4="
35-
script: docker/deli-counter/push.sh
35+
script: ./trigger_docker_build.sh

docker/deli-counter/Dockerfile Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM python:3-alpine
22
WORKDIR /usr/src/app
33

4+
COPY . .
5+
RUN apk -U add git && python setup.py sdist bdist_wheel
6+
7+
FROM python:3-alpine
8+
WORKDIR /usr/src/app
9+
410
# Install build time dependencies for uwsgi
511
# Install uwsgi and dumb-init
612
# Remove build time dependencies
@@ -15,11 +21,11 @@ RUN apk --no-cache add --virtual build-deps \
1521
# Install it
1622
# COPY over wsgi configuration
1723
# TODO: this should be replaced by a build arg to install the correct version from pypi
18-
COPY dist/. .
24+
COPY --from=0 /usr/src/app/dist/. .
1925
RUN bash -c "pip install *"
2026
COPY wsgi.ini wsgi.ini
2127

2228
# add entrypoint
23-
COPY docker/deli-counter/docker-entrypoint.sh /bin/docker-entrypoint.sh
29+
COPY docker-entrypoint.sh /bin/docker-entrypoint.sh
2430

2531
ENTRYPOINT ["/bin/docker-entrypoint.sh"]

compose/postgresql/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM postgres:alpine
2+
3+
ADD compose/postgresql/createPostgresExtension.sh /compose-entrypoint-initdb.d/
4+
RUN chmod 755 /compose-entrypoint-initdb.d/createPostgresExtension.sh

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
postgres:
66
build:
77
context: .
8-
dockerfile: docker/postgresql/Dockerfile
8+
dockerfile: compose/postgresql/Dockerfile
99
environment:
1010
POSTGRES_USER: sandwich
1111
POSTGRES_PASSWORD: hunter2
File renamed without changes.

docker/postgresql/Dockerfile

-4
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)