forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (58 loc) · 2.21 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
### Build and install packages
FROM python:3.9 as build-python
RUN apt-get -y update \
&& apt-get install -y gettext \
# Cleanup apt cache
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
WORKDIR /app
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip pip install poetry==1.7.0
RUN poetry config virtualenvs.create false
COPY poetry.lock pyproject.toml /app/
RUN --mount=type=cache,mode=0755,target=/root/.cache/pypoetry poetry install --no-root
### Final image
FROM python:3.9-slim
RUN groupadd -r saleor && useradd -r -g saleor saleor
RUN apt-get update \
&& apt-get install -y \
libcairo2 \
libgdk-pixbuf2.0-0 \
liblcms2-2 \
libopenjp2-7 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libssl3 \
libtiff6 \
libwebp7 \
libxml2 \
libpq5 \
shared-mime-info \
mime-support \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN echo 'image/webp webp' >> /etc/mime.types
<<<<<<< HEAD
=======
RUN echo 'image/avif avif' >> /etc/mime.types
>>>>>>> fa9ea3af1251eaa792bebc0aabcf03f49b31a7e9
RUN mkdir -p /app/media /app/static \
&& chown -R saleor:saleor /app/
COPY --from=build-python /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/
COPY --from=build-python /usr/local/bin/ /usr/local/bin/
COPY . /app
WORKDIR /app
ARG STATIC_URL
ENV STATIC_URL ${STATIC_URL:-/static/}
RUN SECRET_KEY=dummy STATIC_URL=${STATIC_URL} python3 manage.py collectstatic --no-input
EXPOSE 8000
ENV PYTHONUNBUFFERED 1
LABEL org.opencontainers.image.title="saleor/saleor" \
org.opencontainers.image.description="\
A modular, high performance, headless e-commerce platform built with Python, \
GraphQL, Django, and ReactJS." \
org.opencontainers.image.url="https://saleor.io/" \
org.opencontainers.image.source="https://github.com/saleor/saleor" \
org.opencontainers.image.authors="Saleor Commerce (https://saleor.io)" \
org.opencontainers.image.licenses="BSD 3"
CMD ["gunicorn", "--bind", ":8000", "--workers", "4", "--worker-class", "saleor.asgi.gunicorn_worker.UvicornWorker", "saleor.asgi:application"]