Skip to content

Commit d4b7f5b

Browse files
authored
Merge pull request #12 from DevOps-Jogja/chore-add-uv
Chore add uv
2 parents f090bcc + 1d60bd3 commit d4b7f5b

15 files changed

Lines changed: 438 additions & 68 deletions

.DS_Store

-8 KB
Binary file not shown.

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ __pycache__
44
.venv
55
docker-compose.yml
66
Dockerfile
7+
venv/
8+
**/.DS_Store
9+
dist/

.github/copilot-instructions.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ npm run build-css-prod
4141
### Running the Application
4242
```bash
4343
# Development (port 3000, debug mode)
44-
python app.py
45-
46-
# Flask CLI alternative
47-
export FLASK_APP=app.py && flask run
44+
uv run app.py
4845
```
4946

5047
## Project-Specific Conventions
@@ -79,7 +76,7 @@ export FLASK_APP=app.py && flask run
7976

8077
### Port Configuration
8178
- Development: Port 3000 (`python app.py`)
82-
- Production: Port 5000 (Docker container)
79+
- Production: Port 3000 (Docker container)
8380
- Flask runs with `host="0.0.0.0"` for container compatibility
8481

8582
### Directory Auto-Creation

.github/workflows/deploy.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,17 @@ jobs:
3939
node-version: '18'
4040
cache: 'npm'
4141

42+
- name: Install uv
43+
uses: astral-sh/setup-uv@v6
44+
with:
45+
# Pin to uv version 0.7
46+
version: "0.7"
47+
48+
- name: Set up Python
49+
run: uv python install
50+
4251
- name: Install Python dependencies
43-
run: |
44-
python -m pip install --upgrade pip
45-
pip install -r requirements.txt
52+
run: uv sync --locked --all-extras --dev
4653

4754
- name: Install Node.js dependencies
4855
run: npm install
@@ -57,7 +64,7 @@ jobs:
5764
5865
- name: Build static site
5966
run: |
60-
python build.py
67+
uv run build.py
6168
6269
- name: Setup Pages
6370
uses: actions/configure-pages@v4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
__pycache__/
22
.venv
33
node_modules/
4-
.dist
4+
.dist
5+
venv/
6+
**/.DS_Store
7+
dist/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

Dockerfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ ENV FLASK_ENV=production
99

1010
# Set work directory
1111
WORKDIR /app
12+
13+
# Install uv and python dependencies
14+
COPY --from=ghcr.io/astral-sh/uv:0.7 /uv /uvx /bin/
15+
RUN --mount=type=cache,target=/root/.cache/uv \
16+
--mount=type=bind,source=uv.lock,target=uv.lock \
17+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
18+
uv sync --locked --no-install-project
19+
20+
# Copy application code
1221
COPY . .
1322

1423
# Install system dependencies
@@ -23,16 +32,14 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
2332
&& apt-get install -y nodejs
2433

2534

26-
# Install Python dependencies
27-
RUN pip install --no-cache-dir -r requirements.txt
35+
# Sync the project
36+
RUN --mount=type=cache,target=/root/.cache/uv \
37+
uv sync --locked
2838

2939
# Copy package.json and install Node dependencies
3040
COPY package.json .
3141
RUN npm install
3242

33-
# Copy application code
34-
COPY . .
35-
3643
# Build Tailwind CSS
3744
RUN npm run build-css-prod
3845

@@ -41,12 +48,15 @@ RUN adduser --disabled-password --gecos '' appuser \
4148
&& chown -R appuser:appuser /app
4249
USER appuser
4350

51+
# Place executables in the environment at the front of the path
52+
ENV PATH="/app/.venv/bin:$PATH"
53+
4454
# Expose port
45-
EXPOSE 5000
55+
EXPOSE 3000
4656

4757
# Health check
4858
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
49-
CMD curl -f http://localhost:5000/ || exit 1
59+
CMD curl -f http://localhost:3000/ || exit 1
5060

5161
# Run the application
52-
CMD ["python", "app.py"]
62+
CMD ["uv", "run", "app.py"]

README.md

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
1-
# DevOps Jogja Community Website
1+
# Website Komunitas DevOps Jogja
22

3-
Modern community website untuk DevOps Jogja yang dibangun dengan Flask dan Tailwind CSS.
3+
Website komunitas modern untuk DevOps Jogja yang dibangun dengan Flask dan Tailwind CSS.
44

55
![DevOps Jogja](static/images/cover.png)
66

7-
## 🚀 Features
7+
## 🚀 Fitur
88

9-
- **Modern Homepage** - Berkesan teknologi infrastruktur dengan design responsif
10-
- **Blog System** - Artikel teknologi dari file Markdown
9+
- **Modern Homepage** - Kesan teknologi infrastruktur dengan design responsif
10+
- **Blog System** - Artikel dan blog teknologi dari file Markdown
1111
- **Event Management** - Informasi event dari file Markdown
1212
- **Organizer Profiles** - Profil pengurus dari file YAML
1313
- **About Page** - Informasi komunitas dari file YAML
1414
- **Responsive Design** - Menggunakan Tailwind CSS
1515

16-
## 📋 Prerequisites
16+
## 📋 Pra-syarat
1717

18-
- Python 3.8+
18+
- Python 3.11+
19+
- uv 0.7+
1920
- Node.js 14+
2021
- npm atau yarn
2122

22-
## 🛠️ Installation
23+
## 🛠️ Instalasi
2324

24-
### 1. Clone Repository
25+
### 1. Kloning Repositori
2526

2627
```bash
2728
git clone https://github.com/devops-jogja/devops-jogja-website.git
2829
cd devops-jogja-website
2930
```
3031

31-
### 2. Setup Python Environment
32+
### 2. Siapkan 'environment' python
3233

3334
```bash
34-
# Buat virtual environment
35-
python -m venv venv
36-
37-
# Aktivasi virtual environment
38-
# Di macOS/Linux:
39-
source venv/bin/activate
40-
# Di Windows:
41-
# venv\Scripts\activate
42-
43-
# Install dependencies
44-
pip install -r requirements.txt
35+
# Sync 'environment' dengan uv
36+
uv sync --locked
4537
```
4638

47-
### 3. Setup Tailwind CSS
39+
### 3. Siapkan Tailwind CSS
4840

4941
```bash
5042
# Install Node.js dependencies
@@ -57,25 +49,20 @@ npm run build-css
5749
### 4. Jalankan Aplikasi
5850

5951
```bash
60-
# Development mode
61-
python app.py
62-
63-
# Atau dengan Flask CLI
64-
export FLASK_APP=app.py
65-
export FLASK_ENV=development
66-
flask run
52+
# Dengan uv
53+
uv run app.py
6754
```
6855

69-
Website akan berjalan di `http://localhost:5000`
56+
Website akan berjalan di `http://localhost:3000`
7057

7158
## 📁 Struktur Project
7259

7360
```
7461
devops-jogja-website/
7562
├── app.py # Main Flask application
76-
├── requirements.txt # Python dependencies
77-
├── package.json # Node.js dependencies
78-
├── tailwind.config.js # Tailwind configuration
63+
├── pyproject.toml # Python dependencies
64+
├── package.json # Node.js dependencies
65+
├── tailwind.config.js # Tailwind configuration
7966
├── static/
8067
│ ├── css/
8168
│ │ ├── input.css # Tailwind input
@@ -110,7 +97,7 @@ devops-jogja-website/
11097
└── yaml_loader.py # YAML loader
11198
```
11299

113-
## 📝 Content Management
100+
## 📝 Manajemen konten
114101

115102
### Blog Posts
116103

@@ -233,17 +220,17 @@ Tambahkan interaktivitas di `static/js/main.js`.
233220

234221
## 🚀 Deployment
235222

236-
### Using Docker
223+
### Menggunakan Docker
237224

238225
```bash
239226
# Build image
240227
docker build -t devops-jogja-website .
241228
242229
# Run container
243-
docker run -p 5000:5000 devops-jogja-website
230+
docker run -p 3000:3000 devops-jogja-website
244231
```
245232

246-
### Using Heroku
233+
### Menggunakan Heroku
247234

248235
```bash
249236
# Login to Heroku
@@ -256,12 +243,12 @@ heroku create devops-jogja-website
256243
git push heroku main
257244
```
258245

259-
### Using Railway
246+
### Menggunakan Railway
260247

261-
1. Connect GitHub repository ke Railway
248+
1. Hubungkan GitHub repository ke Railway
262249
2. Deploy otomatis setiap push ke main branch
263250

264-
## 🤝 Contributing
251+
## 🤝 Berkontribusi
265252

266253
1. Fork repository
267254
2. Buat feature branch (`git checkout -b feature/amazing-feature`)

dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ install_deps() {
6060

6161
# Install Python dependencies
6262
print_status "Installing Python dependencies..."
63-
pip3 install -r requirements.txt
63+
uv sync --locked
6464

6565
# Install Node.js dependencies
6666
print_status "Installing Node.js dependencies..."

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ services:
22
web:
33
build: .
44
ports:
5-
- "5000:3000"
5+
- "3000:3000"
66
environment:
77
- FLASK_ENV=development
88
- FLASK_DEBUG=1
99
volumes:
1010
- .:/app
1111
- /app/node_modules
12-
command: python app.py
1312

1413
production:
1514
build: .

0 commit comments

Comments
 (0)