Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container improvements #1496

Merged
merged 4 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
.git
.gitignore

Dockerfile
.dockerignore

*.md
!README*.md
*.rst
docs
.git
.gitignore
.github

Dockerfile
.dockerignore

azure-pipelines.yml
.pre-commit-config.yaml
.semaphore

*.md
!README*.md
MANIFEST.in
setup.py
*.rst

docs
conf
.readthedocs.yml
30 changes: 20 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
ARG IMAGE=python:3.9-alpine
ARG IMAGE=alpine:3.17
FROM ${IMAGE} as builder

WORKDIR /build

# Install dependencies
RUN apk add --no-cache git python3 python3-dev py3-pip py3-wheel build-base gcc libffi-dev openssl-dev musl-dev cargo

# Fetch requirements
COPY requirements.txt .
RUN pip install -r requirements.txt

FROM ${IMAGE}

# Environment vars we can configure against
Expand All @@ -15,19 +26,18 @@ EXPOSE 5050
VOLUME /conf
VOLUME /certs

# Copy appdaemon into image
WORKDIR /usr/src/app
COPY . .

# Install timezone data
RUN apk add tzdata
# Install runtime required packages
# First line is required, 2nd line is for backwards compatibility
RUN apk add --no-cache curl python3 py3-pip tzdata \
git py3-wheel build-base gcc libffi-dev openssl-dev musl-dev cargo

# Install dependencies
RUN apk add --no-cache build-base gcc libffi-dev openssl-dev musl-dev cargo \
&& pip install --no-cache-dir .
# Copy compiled deps from builder image
COPY --from=builder /usr/lib/python3.10/site-packages/ /usr/lib/python3.10/site-packages/

# Install additional packages
RUN apk add --no-cache curl
# Copy appdaemon into image
COPY . .

# Start script
RUN chmod +x /usr/src/app/dockerStart.sh
Expand Down
2 changes: 1 addition & 1 deletion dockerStart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ apk add --no-cache $(find $CONF -name system_packages.txt | xargs cat | tr '\n'
find $CONF -name requirements.txt -exec pip3 install --upgrade -r {} \;

# Lets run it!
exec appdaemon -c $CONF "$@"
exec python3 -m appdaemon -c $CONF "$@"