-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
41 lines (26 loc) · 1.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM ghcr.io/ameyuuno/baseimage/python:3.8.12-alpine3.14 as build
ARG TARGETPLATFORM
ENV PATH="/etc/poetry/bin:${PATH}" \
POETRY_HOME="/etc/poetry" \
POETRY_VERSION="1.1.10"
LABEL maintainer="ameyuuno <ameyuuno@gmail.com>"
WORKDIR /build
COPY ./scripts/install-supercronic.sh ./install-supercronic.sh
RUN apk add --no-cache curl gcc libffi-dev musl-dev && rm -rf /var/cache/apk/* && \
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - && \
chmod +x ./install-supercronic.sh && ./install-supercronic.sh ${TARGETPLATFORM}
COPY poetry.lock poetry.lock
COPY pyproject.toml pyproject.toml
COPY src src
RUN poetry build && python -m pip install --target /build/target/ dist/*.whl
FROM ghcr.io/ameyuuno/baseimage/python:3.8.12-alpine3.14 as runtime
ENV PATH="/build/target/bin:${PATH}" \
PYTHONPATH="/build/target:${PYTHONPATH}" \
TIMEZONE="UTC"
RUN apk add --no-cache tzdata && rm -rf /var/cache/apk/*
COPY --from=build /usr/local/bin/supercronic /usr/local/bin/supercronic
COPY --from=build /build/target/ /build/target/
COPY ./scripts/init.sh /srv/init.sh
RUN chmod +x /srv/init.sh
ENTRYPOINT ["/srv/init.sh"]
CMD ["supercronic", "/srv/unifi-led-switch-crontab-schedule"]