Skip to content

Commit

Permalink
Create Dockerfile
Browse files Browse the repository at this point in the history
This commit introduces a basic container-based runtime by adding a
Dockerfile.

Related issue: pbp-fasilkom-ui#5
  • Loading branch information
addianto committed Aug 31, 2023
1 parent 2411414 commit 56d00d3
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 12 deletions.
78 changes: 78 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Virtual environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Python cache files
__pycache__/

# SQLite database
db.sqlite3
db.sqlite3-journal

# User-uploaded media
media

# Collected static files
staticfiles/

# Coverage
.coverage
.coverage.*
coverage.*
htmlcov/

# Chromedriver
chromedriver
chromedriver.exe

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows shortcuts
*.lnk
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ ehthumbs_vista.db
$RECYCLE.BIN/

# Windows shortcuts
*.lnk
*.lnk
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.6
3.11.5
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use official Python container image
FROM docker.io/library/python:3.11.5-alpine

# Configure environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONBUFFERED=1

# TODO: Configure environment variables required by Django project
# e.g., database connection, parameterised configuration in settings.py

# Set the active working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the declared app dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the source code files into the container
COPY . .

# Expose the port that the app will run on
EXPOSE 8000

# Run the app
CMD ["/bin/sh", "-c", "python manage.py migrate && gunicorn project_django.wsgi --log-file -"]
3 changes: 1 addition & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
release: python manage.py migrate
web: gunicorn project_django.wsgi --log-file -
web: python manage.py migrate && gunicorn project_django.wsgi --log-file -
6 changes: 3 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PBP Django Project Template

Platform-Based Programming (CSGE602022) - Organized by the Faculty of Computer Science Universitas Indonesia, Odd Semester 2022/2023
Platform-Based Programming (CSGE602022) - Organized by the Faculty of Computer Science Universitas Indonesia, Odd Semester 2023/2024

*Read this in other languages: [Indonesian](README.md), [English](README.en.md)*

Expand Down Expand Up @@ -85,7 +85,7 @@ code template repository can be found at: https://django-pbp-template.herokuapp.
If you have successfully created your own repository and set up the Django Web
application project, you can start working on the weekly tutorials and assignments
related to Django Web application development.
related to Django Web application development.
If you found any issues or have ideas to improve the code template, feel free
to discuss your proposal via the [issue tracker](https://github.com/pbp-fasilkom-ui/django-pbp-template/issues)
Expand All @@ -98,4 +98,4 @@ This template was based on [PBP Odd Term 2021/2022](https://gitlab.com/PBP-2021/
[Heroku]: https://www.heroku.com/
[Tutorial 0]: https://pbp-fasilkom-ui.github.io/ganjil-2023/en/assignments/tutorial/tutorial-0
[Visual Studio Code]: https://code.visualstudio.com/
[PyCharm]: https://www.jetbrains.com/pycharm/
[PyCharm]: https://www.jetbrains.com/pycharm/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Template Proyek Django PBP

Pemrograman Berbasis Platform (CSGE602022) - diselenggarakan oleh Fakultas Ilmu Komputer Universitas Indonesia, Semester Ganjil 2022/2023
Pemrograman Berbasis Platform (CSGE602022) - diselenggarakan oleh Fakultas Ilmu Komputer Universitas Indonesia, Semester Ganjil 2023/2024

*Read this in other languages: [Indonesian](README.md), [English](README.en.md)*

Expand Down Expand Up @@ -49,14 +49,14 @@ Apabila kamu ingin menggunakan repositori ini sebagai repositori awalan yang nan
```
7. Bukalah `http://localhost:8000` pada browser favoritmu untuk melihat apakah aplikasi sudah berjalan dengan benar.

## Contoh Deployment
## Contoh Deployment

Pada template ini, deployment dilakukan dengan memanfaatkan GitHub Actions sebagai _runner_ dan Heroku sebagai platform Hosting aplikasi.
Pada template ini, deployment dilakukan dengan memanfaatkan GitHub Actions sebagai _runner_ dan Heroku sebagai platform Hosting aplikasi.

Untuk melakukan deployment, kamu dapat melihat instruksi yang ada pada [Tutorial 0](https://pbp-fasilkom-ui.github.io/ganjil-2023/assignments/tutorial/tutorial-0).

Untuk contoh aplikasi Django yang sudah di deploy, dapat kamu akses di [https://django-pbp-template.herokuapp.com/](https://django-pbp-template.herokuapp.com/)

## Credits

Template ini dibuat berdasarkan [PBP Ganjil 2021](https://gitlab.com/PBP-2021/pbp-lab) yang ditulis oleh Tim Pengajar Pemrograman Berbasis Platform 2021 ([@prakashdivyy](https://gitlab.com/prakashdivyy)) dan [django-template-heroku](https://github.com/laymonage/django-template-heroku) yang ditulis oleh [@laymonage, et al.](https://github.com/laymonage). Template ini dirancang sedemikian rupa sehingga mahasiswa dapat menjadikan template ini sebagai awalan serta acuan dalam mengerjakan tugas maupun dalam berkarya.
Template ini dibuat berdasarkan [PBP Ganjil 2021](https://gitlab.com/PBP-2021/pbp-lab) yang ditulis oleh Tim Pengajar Pemrograman Berbasis Platform 2021 ([@prakashdivyy](https://gitlab.com/prakashdivyy)) dan [django-template-heroku](https://github.com/laymonage/django-template-heroku) yang ditulis oleh [@laymonage, et al.](https://github.com/laymonage). Template ini dirancang sedemikian rupa sehingga mahasiswa dapat menjadikan template ini sebagai awalan serta acuan dalam mengerjakan tugas maupun dalam berkarya.
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.10.6
python-3.11.5

0 comments on commit 56d00d3

Please sign in to comment.