-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from Jerakin/refactor/project-structure
Project structure
- Loading branch information
Showing
75 changed files
with
1,049 additions
and
978 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 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 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 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 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,66 @@ | ||
FROM python:3.9-alpine3.17 as python-base | ||
|
||
# Prevents Python from writing pyc files. | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Keeps Python from buffering stdout and stderr to avoid situations where | ||
# the application crashes without emitting any logs due to buffering. | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# We will be installing venv | ||
ENV VIRTUAL_ENV="/venv" | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
|
||
|
||
# Add project path to python path, this to ensure we can reach it from anywhere | ||
WORKDIR /code | ||
ENV PYTHONPATH="/code:$PYTHONPATH" | ||
|
||
# prepare the virtual env | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
RUN python -m venv $VIRTUAL_ENV | ||
|
||
# BUILDER | ||
FROM python-base as python-builder | ||
|
||
# Install our dependencies | ||
RUN apk update | ||
RUN apk add git | ||
RUN apk add pandoc | ||
RUN apk add build-base linux-headers | ||
|
||
# Python dependencies | ||
WORKDIR /code | ||
|
||
COPY pyproject.toml /code | ||
|
||
# Copy the py project and use a package to convert our pyproject.toml file into a requirements file | ||
# We can not install the pyproject with pip as that would install the project and we only | ||
# wants to install the project dependencies. | ||
RUN python -m pip install toml-to-requirements==0.2.0 | ||
RUN toml-to-req --toml-file pyproject.toml | ||
|
||
RUN python -m pip install --no-cache-dir --upgrade -r ./requirements.txt | ||
|
||
# Copy our source content over | ||
COPY ./src/wikmd /code/wikmd | ||
|
||
# Change the directory to the root. | ||
WORKDIR / | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 5000 | ||
|
||
# Run the application. | ||
CMD ["python", "-m", "wikmd.wiki"] |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
--- | ||
layout: default | ||
title: Development | ||
parent: Installation | ||
nav_order: 12 | ||
--- | ||
|
||
# Regular installation | ||
! It's tested on windows and linux based systems. | ||
! Runs on flask server | ||
|
||
Clone the repository | ||
``` | ||
git clone https://github.com/Linbreux/wikmd.git | ||
``` | ||
|
||
cd in wikmd | ||
``` | ||
cd wikmd | ||
``` | ||
|
||
Create a virtual env and activate it (optional, but highly recommended) | ||
``` | ||
virtualenv venv | ||
source venv/bin/activate | ||
``` | ||
|
||
Install it in [development mode aka editable install](https://setuptools.pypa.io/en/latest/userguide/development_mode.html) | ||
``` | ||
python -m pip install .[dev] --editable | ||
``` | ||
|
||
Run the wiki | ||
``` | ||
python -m wikmd.wiki | ||
``` |
Oops, something went wrong.