-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
43 lines (32 loc) · 1.25 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
############################################################
# Dockerfile to run a Django-based web application
# Based on an AMI
############################################################
# Set the base image to use to Ubuntu
FROM python:3.11-slim-buster AS base
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update -y \
&& apt-get install --no-install-recommends -y \
openssh-client curl procps git vim gcc linux-libc-dev libc6-dev build-essential \
&& apt-get clean \
&& apt-get autoremove -y
# Set env variables used in this Dockerfile (add a unique prefix, such as DEV)
RUN apt update && apt install -y netcat dnsutils
RUN useradd -rm -d /home/app -s /bin/bash -g root -G sudo -u 1001 app
USER app
# Directory in container for all project files
ENV DEV_SRVHOME=/srv
# Local directory with project source
ENV DEV_SRC=code/dev
# Directory in container for project source files
ENV DEV_SRVPROJ=$DEV_SRVHOME/$DEV_SRC
# Create application subdirectories
WORKDIR $DEV_SRVPROJ
# Copy just requirements.txt
COPY requirements.txt /tmp/requirements.txt
# Install Python dependencies
RUN pip install -r /tmp/requirements.txt --no-cache-dir
COPY . .
# Starts Docker Container and keeps it running for Debugging
FROM base as test
ENTRYPOINT ["tail", "-f", "/dev/null"]