/
Dockerfile
45 lines (30 loc) · 1.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
FROM python:3.11
ARG HOST_USER=1000
ENV HOST_USER=${HOST_USER}
ARG HOST_GROUP=1000
ENV HOST_GROUP=${HOST_GROUP}
RUN addgroup --gid ${HOST_GROUP} wooey
RUN useradd -u ${HOST_USER} -g ${HOST_GROUP} wooey
ARG BUILD_DIR=/wooey_build
ENV BUILD_DIR=${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN chown wooey:wooey ${BUILD_DIR}
RUN pip install docker psycopg2 redis
COPY --chown=wooey:wooey setup.py MANIFEST.in Makefile README.md ${BUILD_DIR}/
COPY --chown=wooey:wooey scripts ${BUILD_DIR}/scripts
COPY --chown=wooey:wooey wooey ${BUILD_DIR}/wooey
COPY --chown=wooey:wooey tests ${BUILD_DIR}/tests
RUN pip install -e .[dev]
RUN chmod -R a+rwx ${BUILD_DIR}
ARG WOOEY_PROJECT=docker_wooey
USER wooey
RUN wooify -p ${WOOEY_PROJECT}
WORKDIR ${BUILD_DIR}/${WOOEY_PROJECT}
ENV PYTHONPATH=${BUILD_DIR}/${WOOEY_PROJECT}:${PYTHONPATH}
COPY docker/scripts/run-server run-server
# To prevent volumes from being made as root, we need to make the directory
# first and then create a volume. This will make docker inherit the permissions
# of the folder it is replacing. Otherwise, we will be unable to write to this
# folder as non-root
RUN mkdir -p $BUILD_DIR/$WOOEY_PROJECT/$WOOEY_PROJECT/user_uploads
CMD ["sh", "-c", "make -C ${BUILD_DIR} test"]