This is the Dockerfile, I am getting error at Line 18 i.e. ARG DEV =false, I created a requirements.dev.txt file so those dependencies should not execute on the production but only on the development.
I am overridding that file as true in a .yml file.
Dockerfile:
# Install Python 3.9 image
FROM python:3.9-alpine3.13
# maintainer of the image
LABEL maintainer="tenz8"
# for faster response
ENV PYTHONBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
COPY ./app /app
WORKDIR /app
EXPOSE 8000
#getting overrided in decker-compose.yml
ARG DEV = false
# &&/ used to create new lines for lighter dockerfile
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
/py/bin/pip install -r /tmp/requirements.txt && \
#if condition in shell scripting
if [ $DEV = "true" ]; \
then /py/bin/pip install -r /tmp/requirements.dev.txt ; \
# fi means end of if condition
fi && \
rm -rf /tmp && \
adduser \
--disabled-password \
--no-create-home \
django-user
ENV PATH="/py/bin:$PATH"
USER django-user
docker-compose.yml:
version: "3.9"
services:
app:
build:
context: .
args:
- DEV=true
ports:
- "8000:8000"
volumes:
- ./app:/app
command: >
sh -c "python manage.py runserver 0.0.0.0:8000"
Arguments should not have any space while assigning the value.
Just remove the space.
ARG DEV = false // Incorrect Approach
ARG DEV=false // Correct Approach
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With