Skip to content

Commit 20fff49

Browse files
committed
build improvements
1 parent 6a9335d commit 20fff49

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

.github/workflows/docker.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ jobs:
1111
- 3.8
1212
steps:
1313
- uses: actions/checkout@v1
14+
- uses: actions/setup-python@v1
15+
with:
16+
python-version: ${{ matrix.python }}
1417
- uses: docker/login-action@v1
1518
with:
1619
username: ${{ secrets.DOCKERHUB_USERNAME }}
1720
password: ${{ secrets.DOCKERHUB_TOKEN }}
18-
- run: PYTHON_VERSION=${{ matrix.python }} docker-compose build
19-
- run: docker-compose push
20-
if: ${{ github.event_name == 'tag' }}
21+
- run: pip install . flake8 pytest pytest-cov
22+
- run: make images
23+
- run: make push
24+
if: ${{ github.event_name == 'tags' }}

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ENV PYTHONPATH=/opt/python:/var/task
44
EXPOSE 8000
55
VOLUME /var/task
66
VOLUME /opt/python
7-
COPY dist .
8-
RUN pip install *.tar.gz && rm *.tar.gz
7+
ARG TARBALL=lambda-gateway-latest.tar.gz
8+
COPY ${TARBALL} ${TARBALL}
9+
RUN pip install ${TARBALL} && rm ${TARBALL}
910
ENTRYPOINT [ "python", "-m", "lambda_gateway" ]

Makefile

+14-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ SDIST := dist/$(shell python setup.py --fullname).tar.gz
33
SLEEP := 0
44
TIMEOUT := 3
55

6-
.PHONY: all clean test up upload
6+
.PHONY: all clean images push test up upload
77

8-
all: Dockerfile.3.8.iid Dockerfile.3.7.iid
8+
all: dist/lambda-gateway-latest.tar.gz
99

1010
clean:
1111
rm -rf dist *.iid coverage.xml
1212

13+
images: Dockerfile.3.7.iid Dockerfile.3.8.iid
14+
15+
push: Dockerfile.3.7.iid Dockerfile.3.8.iid
16+
docker push --all-tags $(REPO)
17+
1318
test: coverage.xml
1419

1520
up:
@@ -18,15 +23,19 @@ up:
1823
upload: $(SDIST)
1924
twine upload $<
2025

21-
Dockerfile.%.iid: $(SDIST) Dockerfile
26+
Dockerfile.%.iid: dist/lambda-gateway-latest.tar.gz Dockerfile
2227
docker build \
2328
--build-arg PYTHON_VERSION=$* \
29+
--build-arg TARBALL=$< \
2430
--iidfile $@ \
2531
--tag $(REPO):$* \
2632
.
2733

28-
$(SDIST): coverage.xml
29-
python setup.py sdist
34+
dist/lambda-gateway-latest.tar.gz: $(SDIST)
35+
cp $< $@
36+
37+
dist/lambda-gateway-%.tar.gz: coverage.xml
38+
SETUPTOOLS_SCM_PRETEND_VERSION=$* python setup.py sdist
3039

3140
coverage.xml: $(shell find lambda_gateway tests -name '*.py')
3241
flake8 $^

0 commit comments

Comments
 (0)