Skip to content

Commit

Permalink
Updated devcontainer to use a non-root user
Browse files Browse the repository at this point in the history
- In order not to create unwanted privileged files, devcontainer image
was updated with a non-root user;
  • Loading branch information
mrcoalp committed Jul 9, 2021
1 parent aab1363 commit fe6bb2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use cirrusci flutter image as base
FROM cirrusci/flutter:stable

ENV USER="dev"

# Create user with proper privileges and give it access to required folders for flutter to work
RUN useradd -ms /bin/bash $USER
RUN chown -R $USER /sdks
RUN chown -R $USER /root

# Use newly created user
USER $USER
WORKDIR /home/$USER
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "WingScore",
"image": "cirrusci/flutter:stable",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"postCreateCommand": "flutter pub get",
"extensions": ["dart-code.dart-code", "dart-code.flutter"]
}

0 comments on commit fe6bb2d

Please sign in to comment.