Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Feb 16, 2024
1 parent 70e4aca commit e734cac
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
10 changes: 6 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ RUN apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i $(echo ${LOCAL} | cut -d "." -f1) -c -f $(echo ${LOCAL} | cut -d "." -f2) -A /usr/share/locale/locale.alias ${LOCAL}
ENV LANG ${LOCAL}

RUN docker context use default
RUN docker buildx use default

WORKDIR /workspace
RUN ln -s /workspace/app /app
RUN ln -s /workspace/data /data
# RUN ln -s /workspace/app /app
# RUN ln -s /workspace/data /data

RUN docker context use default
RUN docker buildx use default
# RUN apt-get update && apt-get install gnupg2 -y
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"docker-compose.yaml"
],
"shutdownAction": "stopCompose",
"postCreateCommand": "/bin/bash ./.devcontainer/post-install.sh",
"postCreateCommand": "/bin/bash -lc ./.devcontainer/post-install.sh",
// "postCreateCommand": "make init-devcontainer",
"postStartCommand": "make dev",
"service": "workspace",
"workspaceFolder": "/workspace",
Expand Down
11 changes: 6 additions & 5 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ services:
workspace:
build:
context: ..
ssh:
- default
# ssh:
# - default
dockerfile: .devcontainer/Dockerfile
args:
# 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye,
# 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
VARIANT: 3.10-bullseye
VARIANT: 3-bullseye
LOCAL: fr_FR.UTF-8
ports:
- 8080:8080
environment:
- 8080:8080
volumes:
# - /etc/ssl/certs:/etc/ssl/certs
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ..:/workspace:cached
Expand Down
14 changes: 11 additions & 3 deletions .devcontainer/post-install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
echo "Install ASDF"
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc

echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc
echo ""
echo "Source bashrc"
export PATH=~/.asdf/bin:~/.asdf/shims:$PATH
POETRY_VERSION=$(cat .tool-versions|grep 'poetry' | cut -d " " -f 2)
export PATH=/~/.asdf/installs/poetry/${POETRY_VERSION}/bin:$PATH

export PATH=~/.asdf/installs/poetry/$POETRY_VERSION/bin:$PATH
echo ""
echo "Disable SSL check in Curl (DKT Fix)"
echo "insecure" >> ${HOME}/.curlrc
echo ""
# echo "Update SSL certificates"
# update-ca-certificates
echo ""
echo "Install environment"
make install
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ PY = python3
VENV = .venv
BIN=$(VENV)/bin

PYTHON_VERSION=$(shell cat .tool-versions|grep 'python' | cut -d " " -f 2)
POETRY_VERSION=$(shell cat .tool-versions|grep 'poetry' | cut -d " " -f 2)

define title
@/bin/echo -e "\n------------------------------------------------\n${1}\n------------------------------------------------\n"
endef
Expand Down Expand Up @@ -58,14 +61,21 @@ upgrade-pip:

configure-poetry:
@$(call title,"Poetry set python version")
sed -i 's/python = .*/python = "$(shell cat .tool-versions|grep 'python' | cut -d " " -f 2)"/g' pyproject.toml
sed -i 's/FROM python:.*/FROM python:'$(shell cat .tool-versions|grep 'python' | cut -d " " -f 2)'-slim/g' Dockerfile
poetry env use ~/.asdf/installs/python/$(shell cat .tool-versions|grep 'python' | cut -d " " -f 2)/bin/python
@echo "Update python version $(PYTHON_VERSION) in pyproject.toml"
sed -i 's/python = .*/python = "$(PYTHON_VERSION)"/g' pyproject.toml
@echo "Update python version $(PYTHON_VERSION) in Dockerfile"
sed -i 's/FROM python:.*/FROM python:$(PYTHON_VERSION)-slim/g' Dockerfile
@echo "Update python version $(PYTHON_VERSION) in tox.ini"
sed -i 's/min_python_version.*/min_python_version = $(PYTHON_VERSION)/g' tox.ini
sed -i 's/FROM python:.*/FROM python:$(PYTHON_VERSION)-slim/g' Dockerfile
@$(call title,"Switch venv to $(PYTHON_VERSION)")
poetry env use ~/.asdf/installs/python/$(PYTHON_VERSION)/bin/python
@$(call title,"Poetry self plugin")
poetry self add poetry-plugin-export poetry-dotenv-plugin
poetry self update
@$(call title,"Poetry install")
poetry install
poetry lock
poetry update


clean: python-clean
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ skip_install = true
commands = flake8

[flake8]
min_python_version = 3.6.0
min_python_version = 3.12.1
ignore =
D401,
I100,
Expand Down

0 comments on commit e734cac

Please sign in to comment.