Skip to content

Commit d050c48

Browse files
committed
Test from Dockerfile too
1 parent c497805 commit d050c48

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim-buster
1+
FROM python:3.8-slim-buster as build
22
# python:3.7-slim-stretch (using Debian 9) has fewer issues with invalid https certificiates than python:3.7-slim-buster (using Debian 10).
33
# As of 2019-11-29, python:3.8-slim-stretch doesn't exist. See https://github.com/docker-library/python/issues/428
44
WORKDIR /app
@@ -15,3 +15,13 @@ USER app
1515
ENTRYPOINT ["python", "-m", "ircurltitlebot"]
1616
CMD ["--config-path", "/config/config.yaml"]
1717
STOPSIGNAL SIGINT
18+
19+
FROM build as test
20+
WORKDIR /app
21+
USER root
22+
COPY pylintrc pyproject.toml requirements-dev.in setup.cfg vulture.txt ./
23+
COPY scripts/test.sh ./scripts/test.sh
24+
RUN pip install --no-cache-dir -Ur requirements-dev.in && \
25+
./scripts/test.sh
26+
27+
FROM build

scripts/docker_build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# This script builds a containerized image. It can be run locally or in a remote CI workflow.
3+
set -euxo pipefail
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
cd "${DIR}"/..
6+
7+
BASEDIR="${PWD##*/}"
8+
IMAGE_NAME="${BASEDIR}"
9+
10+
docker build -t "${IMAGE_NAME}" .
11+
docker images

0 commit comments

Comments
 (0)