Skip to content

Commit

Permalink
update devcontainer and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ion2088 committed Feb 8, 2024
1 parent 939a6ce commit 49aff04
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
19 changes: 8 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
// Sets the run context to one level up instead of the .devcontainer folder.
"name": "Firedust",
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile",
"build": {
"target": "firedust-dev"
},
"mounts": [
"source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached"
],
"runArgs": [
"--network", "host"
"--network=host",
"-e", "DEV_NAME=${localEnv:DEV_NAME}",
"-e", "DEV_EMAIL=${localEnv:DEV_EMAIL}"
],
"mounts": [
"source=/home/ubuntu/.ssh,target=/root/.ssh,type=bind,consistency=cached"
],
// Add the IDs of extensions you want installed when the container is created.
"postCreateCommand": "git config --global user.name $DEV_NAME && git config --global user.email $DEV_EMAIL && chmod 600 /root/.ssh/id_rsa",
"customizations": {
"vscode": {
"remoteUser": "dev",
"extensions": [
"ms-azuretools.vscode-docker",
"ms-python.python",
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ repos:
rev: 23.12.1
hooks:
- id: black
language_version: python3.12.1

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM python:3 AS stage

WORKDIR /firedust
WORKDIR /workspaces/firedust

# Env variables and dep versions
ENV POETRY_VERSION=1.6
ENV APP="firedust"
ENV PYTHONPATH="${PYTHONPATH}:/firedust"
ENV POETRY_VERSION=1.6 \
APP="firedust" \
PYTHONPATH="${PYTHONPATH}:/workspaces/firedust/src" \
PATH="$PATH:/root/.poetry/bin"

# Install poetry and copy pyproject
RUN pip install poetry=="$POETRY_VERSION"
Expand All @@ -16,16 +17,19 @@ COPY pyproject.toml poetry.lock ./
# --------------------------------------------------
FROM stage as firedust-dev

ENV PATH="{/home/vscode/local/bin:$PATH}"
ENV ENV="local"
ENV PATH="/home/vscode/local/bin:$PATH" \
ENV="local"

RUN apt-get update && apt-get install -y git
RUN git config --global --add safe.directory /workspaces/firedust
RUN git config --global user.email "$DEV_EMAIL"
RUN git config --global user.name "$DEV_NAME"
# Install development dependencies
RUN apt-get update && \
apt-get install -y git && \
rm -rf /var/lib/apt/lists/* && \
poetry install

RUN poetry install
CMD ["/bin/bash" "ln" "-s" "$(poetry env info --path)" "~/.venv"]
# Git configuration
RUN git config --global --add safe.directory /workspaces/firedust && \
git config --global user.email "$DEV_EMAIL" && \
git config --global user.name "$DEV_NAME"

COPY . .

Expand Down

0 comments on commit 49aff04

Please sign in to comment.