File tree Expand file tree Collapse file tree 6 files changed +60
-7
lines changed
Expand file tree Collapse file tree 6 files changed +60
-7
lines changed Original file line number Diff line number Diff line change 1+ *
2+ ! dist
Original file line number Diff line number Diff line change 1+ name : docker
2+ on :
3+ push :
4+ jobs :
5+ docker :
6+ runs-on : ubuntu-latest
7+ strategy :
8+ matrix :
9+ python :
10+ - 3.7
11+ - 3.8
12+ steps :
13+ - uses : actions/checkout@v1
14+ - uses : docker/login-action@v1
15+ with :
16+ username : ${{ secrets.DOCKERHUB_USERNAME }}
17+ password : ${{ secrets.DOCKERHUB_TOKEN }}
18+ - run : PYTHON_VERSION=${{ matrix.python }} docker-compose build
19+ - run : docker-compose push
20+ if : ${{ github.event_name == 'tag' }}
Original file line number Diff line number Diff line change @@ -127,3 +127,5 @@ dmypy.json
127127
128128# Pyre type checker
129129.pyre /
130+
131+ * .iid
Original file line number Diff line number Diff line change 1+ ARG PYTHON_VERSION=3.8
2+ FROM amazon/aws-lambda-python:${PYTHON_VERSION}
3+ ENV PYTHONPATH=/opt/python:/var/task
4+ EXPOSE 8000
5+ VOLUME /var/task
6+ VOLUME /opt/python
7+ COPY dist .
8+ RUN pip install *.tar.gz && rm *.tar.gz
9+ ENTRYPOINT [ "python" , "-m" , "lambda_gateway" ]
Original file line number Diff line number Diff line change 1+ REPO := amancevice/lambda-gateway-python
12SDIST := dist/$(shell python setup.py --fullname) .tar.gz
23SLEEP := 0
34TIMEOUT := 3
45
56.PHONY : all clean test up upload
67
7- all : $( SDIST )
8+ all : Dockerfile.3.8.iid Dockerfile.3.7.iid
89
910clean :
10- rm -rf dist
11+ rm -rf dist * .iid coverage.xml
1112
1213test : coverage.xml
1314
15+ up :
16+ SLEEP=$(SLEEP ) python -m lambda_gateway -t $(TIMEOUT ) lambda_function.lambda_handler
17+
1418upload : $(SDIST )
1519 twine upload $<
1620
17- up :
18- SLEEP=$(SLEEP ) python -m lambda_gateway -t $(TIMEOUT ) lambda_function.lambda_handler
21+ Dockerfile.% .iid : $(SDIST ) Dockerfile
22+ docker build \
23+ --build-arg PYTHON_VERSION=$* \
24+ --iidfile $@ \
25+ --tag $(REPO ) :$* \
26+ .
27+
28+ $(SDIST ) : coverage.xml
29+ python setup.py sdist
1930
2031coverage.xml : $(shell find lambda_gateway tests -name '* .py')
2132 flake8 $^
2233 pytest
23-
24- $(SDIST ) : coverage.xml
25- python setup.py sdist
Original file line number Diff line number Diff line change 1+ version : ' 3.9'
2+ services :
3+ lambda_gateway :
4+ command : lambda_function.lambda_handler
5+ image : amancevice/lambda-gateway-python:${PYTHON_VERSION:-3.8}
6+ network_mode : bridge
7+ environment :
8+ SLEEP : ${SLEEP:-0}
9+ ports :
10+ - 8000
11+ volumes :
12+ - ./:/var/task
You can’t perform that action at this time.
0 commit comments