This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (40 loc) · 1.54 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
# syntax=docker/dockerfile:1
FROM python:3.10.0rc2-alpine3.14 as back-end-base
LABEL maintainer="Specify Collections Consortium <github.com/specify>"
RUN addgroup -S specify -g 888 \
&& adduser -S specify -G specify -u 888
RUN mkdir -p /home/specify \
&& chown specify.specify /home/specify
RUN mkdir -p /scratch-path/log \
&& mkdir -p /scratch-path/sessions \
&& chown -R specify.specify /scratch-path
WORKDIR /home/specify
USER specify
COPY --chown=specify:specify ./requirements.txt .
RUN python -m venv venv \
&& venv/bin/pip install --no-cache-dir -r ./requirements.txt
COPY --chown=specify:specify ./lmtrex ./lmtrex
FROM back-end-base as dev-back-end
# Debug image reusing the base
# Install dev dependencies for debugging
RUN venv/bin/pip install debugpy
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
ENV FLASK_ENV=development
CMD venv/bin/python -m debugpy --listen 0.0.0.0:${DEBUG_PORT} -m ${FLASK_MANAGE} run --host=0.0.0.0
FROM back-end-base as back-end
ENV FLASK_ENV=production
CMD venv/bin/python -m gunicorn -w 4 --bind 0.0.0.0:5000 ${FLASK_APP}
FROM node:16.10.0-buster as base-front-end
LABEL maintainer="Specify Collections Consortium <github.com/specify>"
USER node
WORKDIR /home/node
COPY --chown=node:node lmtrex/frontend/js_src/package*.json ./
RUN npm install
RUN mkdir dist \
&& chown node:node dist
COPY --chown=node:node lmtrex/frontend/js_src .
FROM base-front-end as front-end
RUN npm run build