Exemple de Dockerfile
# JS Build (From ECR Registry)
FROM 243262675455.dkr.ecr.eu-west-3.amazonaws.com/containers:base as js-build
USER app
COPY frontend /app/frontend
RUN aws codeartifact login --tool npm --domain eqs-store --domain-owner 243262675455 --repository eqs-store
RUN cd /app/frontend && npm config set unsafe-perm true && npm run install:all && npm run build
RUN rm -rf /app/frontend/node_modules/
# PY & Image Build (From ECR Registry)
FROM 243262675455.dkr.ecr.eu-west-3.amazonaws.com/containers:base as py-buil
USER appWORKDIR /app
COPY --from=js-build /app/frontend frontend
COPY smart-contracts/nyx smart-contracts/nyx
COPY backend backend
RUN find frontend/static/dist/css -type f | xargs gzip -f -k -9
RUN find frontend/static/dist/js -type f | xargs gzip -f -k -9
RUN pip3 install --user --upgrade -r /app/backend/scripts/requirements.base
COPY do /app/doCOPY backend/scripts/start_prod.sh /app/start_prod.sh
ENV STATIC_URL=/static STATIC_ROOT=/app/static
ENV LOG_DIR=/app/log UPLOAD_PATH=/app/documents
RUN backend/manage.py collectstatic --noinput --clear
RUN backend/manage.py compilemessages -l en -l fr
EXPOSE 8000
EXPOSE 8001
CMD /usr/bin/bash -euxc /app/start_prod.sh
cd backend && until djcli dbcheck; do sleep 1; done \\
&& EMAIL_BACKEND=main.email.ConsoleEmailBackend ./manage.py migrate --noinput \\
&& cd /app/backend; uvicorn main.asgi:application --workers 12 --host 0.0.0.0 --ws auto --port 8001 --loop asyncio & \\
uwsgi \\
--spooler=/spooler/blockchain \\
--spooler=/spooler/mail \\
--spooler=/spooler/kyc \\
--spooler=/spooler/document_upload \\
--spooler-processes=8 \\
--spooler-frequency=1 \\
--locks=32 \\
--sharedarea 2 \\
--http-socket=0.0.0.0:8000 \\
--http-enable-proxy-protocol \\
--stats=127.0.0.1:8100 \\
--stats-http \\
--memory-report \\
--chdir=/app/backend \\
--spooler-chdir=/app/backend \\
--plugin=python \\
--module=main.wsgi:application \\
--http-keepalive \\
--harakiri=1024 \\
--max-requests=100 \\
--listen 1024 \\
--spooler-max-tasks=100 \\
--master \\
--workers=12 \\
--processes=6 \\
--chmod=666 \\
--log-5xx \\
--vacuum \\
--enable-threads \\
--post-buffering=8192 \\
--ignore-sigpipe \\
--ignore-write-errors \\
--disable-write-exception \\
--mime-file /etc/mime.types \\
--thunder-lock \\
--offload-threads '%k' \\
--route '^/static/.* addheader:Cache-Control: public, max-age=7776000' \\
--route '^/js|css|fonts|images|icons|favicon.png/.* addheader:Cache-Control: public, max-age=7776000' \\
--static-map /static/fonts=/app/frontend/static/dist/fonts \\
--static-map /static/images=/app/frontend/static/dist/images \\
--static-map /static/icons=/app/frontend/static/dist/icons \\
--static-map /static/favicon.png=/app/frontend/static/dist/favicon.png \\
--static-map /fonts=/app/frontend/static/dist/fonts \\
--static-map /images=/app/frontend/static/dist/images \\
--static-map /icons=/app/frontend/static/dist/icons \\
--static-map /favicon.png=/app/frontend/static/dist/favicon.png \\
--static-map /dist=/app/frontend/static/dist \\
--static-map /js=/app/frontend/static/dist/js \\
--static-map /css=/app/frontend/static/dist/css \\
--static-map /static=/app/static \\
--static-gzip-all