-
Notifications
You must be signed in to change notification settings - Fork 303
Add Dockerfile and INSTRUCTION.md #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ARG PYTHON_VERSION=3.12-slim | ||
|
|
||
|
|
||
| FROM python:${PYTHON_VERSION} AS build | ||
|
|
||
| WORKDIR /devops_todolist | ||
|
|
||
| ENV PYTHONUNBUFFERED=1 | ||
|
|
||
| COPY requirements.txt . | ||
|
|
||
| RUN pip install --no-cache-dir --prefix=/install -r requirements.txt | ||
|
|
||
|
|
||
|
|
||
| FROM python:${PYTHON_VERSION} AS run | ||
|
|
||
| WORKDIR /devops_todolist | ||
|
|
||
| ENV PYTHONUNBUFFERED=1 | ||
|
|
||
| COPY --from=build /install /usr/local | ||
|
|
||
| COPY . . | ||
|
|
||
| EXPOSE 8080 | ||
|
|
||
| CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8080"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Repo: https://hub.docker.com/repository/docker/midandnight/todoapp/general | ||
| Build: docker build -t midandnight/todoapp:1.0.0 . | ||
| Run: docker run -p 8080:8080 midandnight/todoapp:1.0.0 | ||
| Open: http://localhost:8080 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good approach for running migrations at startup. However, the task description specifically requires executing the database migration as a
RUNinstruction, which means it should happen during the image build process. Please move thepython manage.py migratecommand into its ownRUNstep before theCMDinstruction.