Skip to content
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

Simplify docker compose #607

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[Fleet Manager](https://en.wikipedia.org/wiki/Fleet_management)
for [Polish Humanitarian Action](https://www.pah.org.pl).

[![Build Status](https://travis-ci.com/CodeForPoznan/pah-fm.svg?branch=master)](https://travis-ci.com/CodeForPoznan/pah-fm)
[![Join Slack](https://img.shields.io/badge/slack-join%20chat-4a154b)](https://join.slack.com/t/codeforpoznan/shared_invite/enQtNjQ5MTU1MDI0NDA0LWNhYTA3NGQ0MmQ5ODgxODE3ODJlZjc3NWE0NTMzZjhmNDBkN2QwMzNhYWY5OWQ5MGE2OGM3NjAyODBlY2VjNjU)


Expand Down Expand Up @@ -72,7 +71,7 @@ Here's a high-level description of the project's structure:
- frontend
- `main purpose:` Interactive interface for application
- `language:` JavaScript
- `framework:` React
- `framework:` React.js


<br>
Expand Down
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY Pipfile Pipfile.lock ./

RUN pip install --upgrade pip \
&& pip install pipenv==2022.1.8 \
&& pipenv sync --system --dev
&& pipenv install --system --dev

ADD . /pah-fm/backend

Expand Down
2 changes: 1 addition & 1 deletion backend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

wait-for-it db:5432
wait-for-it database:5432

./manage.py migrate
./manage.py create_admin hello@codeforpoznan.pl pass123 UA --django-admin
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated by Django 4.0.6 on 2022-08-10 22:16

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("fleet_management", "0026_alter_refuel_total_cost_currency_and_more"),
]

operations = [
migrations.AlterField(
model_name="car",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="drive",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="project",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="refuel",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="user",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
57 changes: 18 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,41 @@
version: "3.5"
version: "3"

services:

frontend:
networks: [pah]
container_name: pah-fm-frontend
image: codeforpoznan/pah-fm-frontend
# used for local frontend build (enables service worker etc)
# environment:
# NODE_ENV: production
command: bash docker-entrypoint.sh
ports:
- 8080:8080
volumes:
- ./frontend:/pah-fm/frontend
- asset-volume:/pah-fm/frontend/dist
depends_on:
- webserver
environment:
VUE_APP_API_URL: http://localhost:8000/api/

backend:
networks: [pah]
container_name: pah-fm-backend
image: codeforpoznan/pah-fm-backend
command: bash docker-entrypoint.sh
stdin_open: true
tty: true
links:
- database:database
ports:
- 4444:4444
- 8000:8000
volumes:
- ./backend:/pah-fm/backend
environment:
BASE_URL: http://localhost:8080
PAH_FM_DB_HOST: db
BASE_URL: http://localhost:8000
PAH_FM_DB_HOST: database
SECRET_KEY: pah-fm
DEBUG: 1
DJANGO_LOG_LEVEL: 'DEBUG'
links:
- db:db
volumes:
- ./backend:/pah-fm/backend
DJANGO_LOG_LEVEL: DEBUG

db:
networks: [pah]
database:
container_name: pah-fm-database
image: postgres:14.4
ports:
- 5432:5432
environment:
POSTGRES_DB: pah-fm
POSTGRES_USER: pah-fm
POSTGRES_PASSWORD: pah-fm

webserver:
networks: [pah]
image: nginx
volumes:
- ./pah-fm.conf:/etc/nginx/nginx.conf
- asset-volume:/var/www/:ro
ports:
- 8080:80
depends_on:
- backend

volumes:
asset-volume:

networks:
pah:
name: pah
1 change: 1 addition & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
1 change: 0 additions & 1 deletion frontend/.env

This file was deleted.

File renamed without changes.
8 changes: 5 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM node:8.12.0

EXPOSE 4200
EXPOSE 8080

WORKDIR /pah-fm/frontend

ADD package*.json /pah-fm/frontend/
COPY package.json package-lock.json ./

RUN npm install

ADD . /pah-fm/frontend
ADD ./ ./

ENTRYPOINT ["bash", "docker-entrypoint.sh"]
4 changes: 1 addition & 3 deletions frontend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env bash

npm install
rm -rf /pah-fm/frontend/dist/* || true
npm run watch
npm run serve
63 changes: 0 additions & 63 deletions pah-fm.conf

This file was deleted.