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
127
127
128
128
# Pyre type checker
129
129
.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
1
2
SDIST := dist/$(shell python setup.py --fullname) .tar.gz
2
3
SLEEP := 0
3
4
TIMEOUT := 3
4
5
5
6
.PHONY : all clean test up upload
6
7
7
- all : $( SDIST )
8
+ all : Dockerfile.3.8.iid Dockerfile.3.7.iid
8
9
9
10
clean :
10
- rm -rf dist
11
+ rm -rf dist * .iid coverage.xml
11
12
12
13
test : coverage.xml
13
14
15
+ up :
16
+ SLEEP=$(SLEEP ) python -m lambda_gateway -t $(TIMEOUT ) lambda_function.lambda_handler
17
+
14
18
upload : $(SDIST )
15
19
twine upload $<
16
20
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
19
30
20
31
coverage.xml : $(shell find lambda_gateway tests -name '* .py')
21
32
flake8 $^
22
33
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