Skip to content

Commit

Permalink
split vscode image into seperate image
Browse files Browse the repository at this point in the history
  • Loading branch information
nznobody committed Aug 30, 2021
1 parent b3606ca commit 724953c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "dev",
"service": "vscode",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
Expand Down Expand Up @@ -45,8 +45,8 @@
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created - for example installing curl.
"postCreateCommand": "ln -f -s /usr/local/bin/python3 /usr/bin/python3 && python3 -m pip install -U sphinx rstcheck snooty && python3 setup.py develop",
"postCreateCommand": "sudo python3 setup.py develop && sudo chmod o+rw /var/run/docker.sock",

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
"remoteUser": "vscode"
}
9 changes: 5 additions & 4 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
dev:
vscode:
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
Expand All @@ -16,9 +16,10 @@ services:
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile
image: hiveeyes/vscode:latest
build:
context: .
dockerfile: .devcontainer/vscode.dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
Expand Down
23 changes: 23 additions & 0 deletions .devcontainer/vscode.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Must build the normal dev image first!
FROM hiveeyes/dev:latest

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Make Python3.9 the default python (since some extension us /usr/bin/python3)
RUN ln -f -s /usr/local/bin/python3 /usr/bin/python3 && \
python3 -m pip install -U sphinx rstcheck snooty

# Add docker CLI tools
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
5 changes: 0 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ services:
- "80"

build:
profiles: ["build"]
image: hiveeyes/dev:latest
volumes:
- ./:/src/terkin-datalogger
Expand All @@ -39,10 +38,6 @@ services:
python3 setup.py clean --all"
daemon:
profiles: ["run"]
depends_on:
- dev
- build
build:
context: .
dockerfile: daemon.dockerfile
Expand Down

0 comments on commit 724953c

Please sign in to comment.