Skip to content

Commit ae80aa6

Browse files
devcontainer dockerfile
1 parent 1bf02bd commit ae80aa6

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ARG PYTHON_VERSION=3.12-bullseye
2+
FROM mcr.microsoft.com/vscode/devcontainers/python:${PYTHON_VERSION}
3+
4+
ENV PYTHONUNBUFFERED=1
5+
ENV DJANGO_SETTINGS_MODULE='config.docker-compose'
6+
7+
RUN mkdir /code
8+
WORKDIR /code
9+
10+
RUN apt-get update && \
11+
apt-get install -y --no-install-recommends \
12+
libpq-dev \
13+
build-essential \
14+
rustc \
15+
cargo && \
16+
apt-get clean && rm -rf /var/lib/apt/lists/*
17+
18+
RUN addgroup --gid 1001 --system pokeapi && \
19+
adduser --uid 1001 --system --ingroup pokeapi --shell /bin/bash pokeapi
20+
21+
RUN chown -R pokeapi:pokeapi /code
22+
23+
USER pokeapi
24+
25+
ADD requirements.txt /code/
26+
ADD test-requirements.txt /code/
27+
RUN python3 -m pip install -r test-requirements.txt --no-cache-dir
28+
29+
ADD . /code/
30+
31+
CMD ["sleep", "infinity"]

.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@
4747
"installOhMyZsh": "false",
4848
"configureZshAsDefaultShell": "false"
4949
},
50-
"ghcr.io/devcontainers/features/git:1": {}
50+
"ghcr.io/devcontainers/features/git:1": {},
51+
"ghcr.io/devcontainers/features/docker-outside-of-docker": {}
5152
},
5253

5354
// Post-create commands:
54-
"postCreateCommand": "apk add --no-cache make && git config --global core.autocrlf input",
55+
"postCreateCommand": "git config --global core.autocrlf input && git config --global --add safe.directory /code",
5556

56-
"remoteUser": "root",
57+
"remoteUser": "pokeapi",
5758

5859
// Ports to forward from container to host for easy access
5960
"forwardPorts": [80, 443, 8000, 8080],

.devcontainer/docker-compose.override.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ version: '2.4'
22

33
services:
44
app:
5-
image: pokeapi/pokeapi:master
6-
command: []
5+
build:
6+
context: .
7+
dockerfile: ./.devcontainer/Dockerfile
8+
user: pokeapi

0 commit comments

Comments
 (0)