Skip to content

Commit 435df07

Browse files
authored
Merge pull request #1 from jamjon3/develop
Switching this to multistage docker build
2 parents 9cef021 + 456d474 commit 435df07

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.fedoraproject.org/fedora:latest
1+
FROM registry.fedoraproject.org/fedora:latest AS base
22

33
LABEL maintainer="James Jones <jamjon3@gmail.com>"
44
LABEL description="This project illustrates a python app that uses an API \
@@ -7,6 +7,9 @@ to derive a download URL and download the target file."
77
# Install some dependencies
88
RUN dnf install -y rubygems ruby-devel gcc gcc-c++ make \
99
libffi-devel python3 python3-pip python3-virtualenv python-unversioned-command
10+
11+
FROM base AS build
12+
1013
WORKDIR /output
1114

1215
# Copy over python related files
@@ -24,13 +27,10 @@ RUN source venv/bin/activate \
2427
RUN source venv/bin/activate \
2528
&& exec python build.py
2629

27-
# Move the binary into /usr/bin
28-
RUN mv dist/getlatestdownloadbinary /usr/bin/getlatestdownloadbinary
30+
FROM base AS final
2931

30-
WORKDIR /
31-
32-
# Clear out all the build files and virtual environment for Python
33-
RUN rm -Rf /output
32+
# Move the binary into /usr/bin
33+
COPY --from=build --chown=root:root /output/dist/getlatestdownloadbinary /usr/bin/getlatestdownloadbinary
3434

3535
# Setup the entrypoint script
3636
COPY entrypoint.sh /usr/bin/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ as well as another small class for downloading te release binary.
2323
Uses a docker container to 'build' the 'Option 1' basic app into a binary inside a container
2424
using:
2525

26-
```docker build --tag sample .```
26+
```docker build --target final --tag sample .```
2727

2828
This builds a container with the PyInstaller binary setup with an entrypoint
2929
so it can be executed without specifying the binary:

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.0.1'

0 commit comments

Comments
 (0)