-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.pytest
36 lines (28 loc) · 912 Bytes
/
Dockerfile.pytest
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
FROM python:3.10-alpine
ARG USER=kevinwang
ARG GROUP=wheel
USER root
RUN \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk upgrade --no-cache && \
apk add --update --no-cache \
docker \
sudo
# create a password-less user and add to wheel group
RUN \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
adduser -D -G $GROUP $USER && \
addgroup $USER docker
# update login shell to use zsh
RUN sed -i 's/\/bin\/ash/\/bin\/zsh/g' /etc/passwd
# switch to the user
USER $USER
WORKDIR /home/$USER
# TODO: figure out how to avoid hardcoding this path
ARG DOTFILE_DIR=/home/$USER/projects/dotfiles
COPY --chown=$USER:$GROUP . $DOTFILE_DIR
RUN cd $DOTFILE_DIR && ./install.sh
# TODO: how do we layer this on top of the previous dockerfile?
WORKDIR $DOTFILE_DIR
RUN pip install -r requirements.txt
CMD ["python", "-m", "pytest", "-r", "tests"]