-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathDockerfile
More file actions
111 lines (94 loc) · 3.78 KB
/
Dockerfile
File metadata and controls
111 lines (94 loc) · 3.78 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
ARG NGINX_LISTEN_OPTS
# AUTHOR: Clay Teeter <teeterc@gmail.com>, Nicholas Long <nicholas.long@nlr.gov>
# DESCRIPTION: Image with seed platform and dependencies running in development mode
# TO_BUILD_AND_RUN: docker compose build && docker compose up
FROM node:24-alpine
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN corepack enable
ARG NGINX_LISTEN_OPTS
RUN apk add --no-cache \
postgresql-dev \
coreutils \
alpine-sdk \
pcre \
pcre-dev \
libxslt-dev \
linux-headers \
libffi-dev \
bash \
bash-completion \
nginx \
brotli \
nginx-mod-http-brotli \
openssl-dev \
geos-dev \
gdal \
gdal-dev \
gcc \
musl-dev \
cargo \
tzdata \
bzip2-dev \
readline-dev \
sqlite-dev \
ncurses-dev \
xz-dev \
zlib-dev \
libxml2-dev && \
mkdir -p /var/log/supervisord && \
mkdir -p /run/nginx
## Note on some of the commands above:
## - coreutils is required due to an issue with our wait-for-it.sch script:
## https://github.com/vishnubob/wait-for-it/issues/71
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_INSTALL_DIR="/opt/uv/python"
ENV UV_PROJECT_ENVIRONMENT="/seed/.venv"
ENV PATH="/seed/.venv/bin:$PATH"
### Install python dependencies
WORKDIR /seed
COPY ./.python-version /seed/.python-version
COPY ./pyproject.toml /seed/pyproject.toml
COPY ./uv.lock /seed/uv.lock
RUN uv sync --frozen --managed-python --no-dev --no-install-project && \
uv pip install supervisor==4.3.0
### Install JavaScript requirements - do this first because they take a while
### and the dependencies will probably change slower than python packages.
COPY ./package.json /seed/package.json
COPY ./pnpm-lock.yaml /seed/pnpm-lock.yaml
COPY ./pnpm-workspace.yaml /seed/pnpm-workspace.yaml
COPY ./vendors/package.json /seed/vendors/package.json
COPY ./vendors/pnpm-lock.yaml /seed/vendors/pnpm-lock.yaml
COPY ./ng_seed/seed-angular /seed/ng_seed/seed-angular
### Build SEED Angular then cleanup
RUN pnpm install --frozen-lockfile && \
pnpm -C /seed/ng_seed/seed-angular build && \
pnpm install --prod --frozen-lockfile --ignore-scripts && \
rm -rf /seed/ng_seed/seed-angular/node_modules && \
pnpm store prune
### Copy over the remaining part of the SEED application and some helpers
COPY . /seed/
COPY ./docker/wait-for-it.sh /usr/local/wait-for-it.sh
RUN git config --system --add safe.directory /seed
# nginx configuration - replace the root/default nginx config file and add included files
COPY ./docker/nginx/*.conf /etc/nginx/
COPY ./docker/nginx/nginx.conf.template /etc/nginx/nginx.conf.template
# Install gettext package for envsubst and then generate nginx.conf from the template
RUN apk add --no-cache gettext && \
if [ -z "${NGINX_LISTEN_OPTS}" ]; then \
echo "NGINX_LISTEN_OPTS is unset or empty, defaulting to: HTTP1.1"; \
else \
echo "NGINX_LISTEN_OPTS is set to: ${NGINX_LISTEN_OPTS}"; \
fi && \
envsubst '${NGINX_LISTEN_OPTS}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# symlink maintenance.html that nginx will serve in the case of a 503
RUN ln -sf /seed/collected_static/maintenance.html /var/lib/nginx/html/maintenance.html
# set execute permissions on the maint script to toggle on and off
RUN chmod +x ./docker/maintenance.sh
# Supervisor looks in /etc/supervisor for the configuration file.
COPY ./docker/supervisor-seed.conf /etc/supervisor/supervisord.conf
# entrypoint sets some permissions on directories that may be shared volumes
COPY ./docker/seed-entrypoint.sh /usr/local/bin/seed-entrypoint
RUN chmod 775 /usr/local/bin/seed-entrypoint
ENTRYPOINT ["seed-entrypoint"]
EXPOSE 80
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]