Skip to content

Commit 6ca0610

Browse files
author
Anthony Hastings
committed
Updating docker containers to use Dockerize.
1 parent e78d600 commit 6ca0610

File tree

5 files changed

+25
-373
lines changed

5 files changed

+25
-373
lines changed

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
producer:
3333
build: ./services/producer
3434
container_name: kafka-nodejs-example-producer
35-
command: ./wait-for-it.sh zookeeper:2181 -- ./wait-for-it.sh kafka:9092 -- ./wait-for-it.sh database:5432 -- npm start
35+
command: sh -c "dockerize -wait tcp://zookeeper:2181 -wait tcp://kafka:9092 -wait tcp://database:5432 npm start"
3636
depends_on:
3737
- zookeeper
3838
- kafka
@@ -50,7 +50,7 @@ services:
5050
consumer:
5151
build: ./services/consumer
5252
container_name: kafka-nodejs-example-consumer
53-
command: ./wait-for-it.sh zookeeper:2181 -- ./wait-for-it.sh kafka:9092 -- ./wait-for-it.sh database:5432 -- npm start
53+
command: sh -c "dockerize -wait tcp://zookeeper:2181 -wait tcp://kafka:9092 -wait tcp://database:5432 npm start"
5454
depends_on:
5555
- zookeeper
5656
- kafka
@@ -61,4 +61,4 @@ services:
6161
PGUSER: ${POSTGRES_USER}
6262
PGDATABASE: ${POSTGRES_USER}
6363
PGPASSWORD: ${POSTGRES_PASSWORD}
64-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
64+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181

services/consumer/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
FROM node:8.11.3-alpine
1+
FROM node:10.9-alpine
22
MAINTAINER Anthony Hastings <[email protected]>
33

4-
# Installing bash.
5-
RUN apk add --no-cache bash bash-doc bash-completion
6-
74
# Create a directory (to house our source files) and navigate to it.
85
WORKDIR /src
96

10-
# Copy over the bash script to test and wait on the availability of a TCP host and port.
11-
COPY ./wait-for-it.sh /src/
12-
RUN chmod +x /src/wait-for-it.sh
7+
# Installing dockerize which can test and wait on the availability of a TCP host and port.
8+
ENV DOCKERIZE_VERSION v0.6.1
9+
RUN apk add --no-cache openssl \
10+
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
11+
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
12+
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
13+
14+
# Installing bash.
15+
RUN apk add --no-cache bash bash-doc bash-completion
1316

1417
# Copy over the package.json and lock file to the containers working directory.
1518
COPY ./package.json ./package-lock.json /src/
@@ -24,4 +27,4 @@ RUN apk add --no-cache --virtual .gyp \
2427
&& apk del .gyp
2528

2629
# Copy everything in the host folder into the working folder of the container.
27-
COPY ./src /src/
30+
COPY ./src /src/

services/consumer/wait-for-it.sh

Lines changed: 0 additions & 177 deletions
This file was deleted.

services/producer/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
FROM node:8.11.3-alpine
1+
FROM node:10.9-alpine
22
MAINTAINER Anthony Hastings <[email protected]>
33

4-
# Installing bash.
5-
RUN apk add --no-cache bash bash-doc bash-completion
6-
74
# Create a directory (to house our source files) and navigate to it.
85
WORKDIR /src
96

10-
# Copy over the bash script to test and wait on the availability of a TCP host and port.
11-
COPY ./wait-for-it.sh /src/
12-
RUN chmod +x /src/wait-for-it.sh
7+
# Installing dockerize which can test and wait on the availability of a TCP host and port.
8+
ENV DOCKERIZE_VERSION v0.6.1
9+
RUN apk add --no-cache openssl \
10+
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
11+
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
12+
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
13+
14+
# Installing bash.
15+
RUN apk add --no-cache bash bash-doc bash-completion
1316

1417
# Copy over the package.json and lock file to the containers working directory.
1518
COPY ./package.json ./package-lock.json /src/
@@ -27,4 +30,4 @@ RUN apk add --no-cache --virtual .gyp \
2730
COPY ./src /src/
2831

2932
# Expose the specified port back to the host machine.
30-
EXPOSE 8080
33+
EXPOSE 8080

0 commit comments

Comments
 (0)