forked from mrako/wait-for
-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: makes docker build produce a runnable wait-for image (#2) Than…
…ks to @gesellix This change alters the Dockerfile used in this project. Now, it is a multi-stage Dockerfile with one stage which can be used to run the tests and one stage which is a runnable image including the wait-for script. In this way, we run the tests in a similar-ish* environment as what the script runs in when distributed as a container image. *The tests are setup and ran using Node and npm. The final image doesn't include those two dependencies to create a more slim image. Co-authored-by: Adriaan Knapen <[email protected]>
- Loading branch information
Showing
7 changed files
with
6,554 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
|
||
# Node | ||
node_modules | ||
|
||
delay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
FROM node:16-alpine@sha256:a9b9cb880fa429b0bea899cd3b1bc081ab7277cc97e6d2dcd84bd9753b2027e1 | ||
################# | ||
# Base layer # | ||
################# | ||
FROM alpine:edge as runtime-base | ||
|
||
# Install bash | ||
RUN apk add --no-cache bash | ||
# Install all dependencies | ||
RUN apk add --no-cache bash nmap-ncat wget | ||
|
||
# Create working directory | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
################# | ||
# Test image # | ||
################# | ||
FROM runtime-base as test-env | ||
|
||
# Install Node.js | ||
RUN apk add --no-cache nodejs npm | ||
|
||
# Install all Node dependencies | ||
COPY package.json /app/ | ||
COPY package-lock.json /app/ | ||
|
||
RUN npm ci | ||
|
||
# Copy source code | ||
COPY . /app/ | ||
|
||
# Define default command | ||
# Perform tests when running this test-env container | ||
CMD npm test | ||
|
||
################# | ||
# Runtime image # | ||
################# | ||
FROM runtime-base as runtime | ||
|
||
COPY ./wait-for . | ||
|
||
ENTRYPOINT ["./wait-for"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.