Skip to content

Commit

Permalink
Add builder stage to Dockerfile
Browse files Browse the repository at this point in the history
Fixes #174
  • Loading branch information
okigan committed Jun 14, 2023
1 parent 8c81a65 commit 88a64e5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
36 changes: 23 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Build stage
FROM python:3-alpine AS builder

RUN set -ex && \
apk add \
build-base \
libffi-dev \
libxml2-dev \
openssl-dev

COPY . /app-source-dir

RUN pip install --target=/app/python-packages ./app-source-dir


# Runtime stage
FROM python:3-alpine
COPY . /
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
build-base \
libffi-dev \
libxml2-dev \
openssl-dev \
&& apk add --no-cache --virtual .run-deps \
libxslt-dev \
&& pip install -r requirements.txt \
&& apk del .build-deps

ENTRYPOINT ["python", "-m", "awscurl.awscurl"]

COPY --from=builder /app /app

ENV PATH=/app/python-packages/bin:${PATH}
ENV PYTHONPATH=/app/python-packages

ENTRYPOINT ["awscurl"]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ venv:
pip install --upgrade setuptools; \
pip install -r requirements.txt -r requirements-test.txt; \
)

docker-build:
docker build -t awscurl .

docker-run:
docker run -it --rm awscurl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ docker pull ghcr.io/okigan/awscurl
* Call S3: List bucket content

```sh
$ awscurl --service s3 https://awscurl-sample-bucket.s3.amazonaws.com | tidy -xml -iq
$ awscurl --service s3 'https://awscurl-sample-bucket.s3.amazonaws.com' | tidy -xml -iq
<?xml version="1.0" encoding="utf-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>awscurl-sample-bucket</Name>
Expand Down

0 comments on commit 88a64e5

Please sign in to comment.