Last active
November 1, 2022 05:01
-
-
Save ydf/7273f0c470626a7428d49312e3efc12a to your computer and use it in GitHub Desktop.
django development env, use docker container with ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.11-slim as base | |
FROM base as builder | |
COPY requirements.txt . | |
RUN apt-get update && apt-get install -y --no-install-recommends default-libmysqlclient-dev gcc && apt-get clean --yes && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
RUN mkdir /install && pip install --no-cache-dir --prefix=/install -r requirements.txt && rm -rf /tmp/* /var/tmp/* | |
FROM base | |
COPY --from=builder /install /usr/local | |
COPY --from=builder /usr/lib/x86_64-linux-gnu/libmariadb.s* /usr/lib/x86_64-linux-gnu/ | |
RUN apt-get update && apt-get install -y openssh-server | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:SOS------=iz5XJssOgLM6XGk6ouvGOuAu-----' | chpasswd | |
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
EXPOSE 22 | |
CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment