-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devops): dockerize the whole application (#296)
- Loading branch information
1 parent
6a6ec02
commit 4de27f4
Showing
6 changed files
with
70 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# version is deprecated after docker 25.X | ||
# version: '3.7' | ||
|
||
|
||
services: | ||
db: | ||
image: mysql:8.0 | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: example | ||
MYSQL_DATABASE: mydatabase | ||
MYSQL_USER: user | ||
MYSQL_PASSWORD: password | ||
|
||
backend: | ||
build: | ||
context: ./backend | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- ./backend:/home/app/backend | ||
command: > | ||
sh -c "python manage.py makemigrations && | ||
python manage.py migrate && | ||
python manage.py runserver 0.0.0.0:8000" | ||
env_file: ./backend/.env | ||
restart: "on-failure" | ||
depends_on: | ||
- db | ||
|
||
web: | ||
build: | ||
context: ./web | ||
ports: | ||
- "5173:5173" | ||
volumes: | ||
- ./web:/home/app/web | ||
command: > | ||
sh -c "npm install && | ||
npm run build && | ||
serve -s dist -l 5173" | ||
restart: "on-failure" | ||
depends_on: | ||
- backend | ||
|
||
volumes: | ||
db_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:18.20-bullseye-slim | ||
|
||
ENV DockerHOME=/home/app/web | ||
|
||
WORKDIR ${DockerHOME} | ||
|
||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
|
||
COPY . ${DockerHOME} | ||
|
||
RUN npm run build | ||
|
||
RUN npm install -g serve | ||
|
||
EXPOSE 5173 | ||
|
||
CMD [ "serve", "-s", "build", "-l", "5173"] |
Oops, something went wrong.