File tree Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ .git
Original file line number Diff line number Diff line change
1
+ FROM fedora:latest
2
+ RUN dnf --setopt=deltarpm=0 --verbose install -y passwd sudo vim-enhanced less redhat-rpm-config \
3
+ @development-tools gcc-c++ autoconf automake libtool zlib-devel \
4
+ rubygem-bundler ruby-devel kernel-headers
5
+ WORKDIR /weldr.io/
6
+
7
+ # Run as user passed in with --env LOCAL_UID=`id -u`
8
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
9
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh" ]
Original file line number Diff line number Diff line change 2
2
3
3
Notes for weldrists writing for weldr.io.
4
4
5
+ ## Testing locally using containers
6
+
7
+ This will build a container, install the needed fedora packages and mount the current directory as
8
+ your user id (so that you can edit from within the container without making everything owned by root).
9
+
10
+ sudo docker build -t weldr/jekyll .
11
+ sudo docker run -it --name=jekyll --security-opt="label=disable" -v "$PWD:/weldr.io/" --env LOCAL_UID=`id -u` -p 4000:4000 weldr/jekyll /usr/bin/bash
12
+ bundle install --binstubs=/tmp/bin/
13
+ bundle exec /tmp/bin/jekyll serve --host=0.0.0.0 --incremental
14
+
15
+ ...then just open http://localhost:4000/ and you're off. On subsequent runs you can reuse the container with:
16
+
17
+ sudo docker start -i jekyll
18
+
5
19
## Testing locally
6
20
7
21
See README.md as well, but here's the quick version:
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Setup a user account from environment:
4
+ # LOCAL_USERNAME
5
+ # LOCAL_UID
6
+ USERNAME=${LOCAL_USERNAME:- user}
7
+ USER_ID=${LOCAL_UID:- 1000}
8
+
9
+ if [ " $USERNAME " == " root" ]; then
10
+ echo " Running as root"
11
+ exec " $@ "
12
+ else
13
+ echo " Running with $USERNAME :$USER_ID "
14
+ useradd -u " $USER_ID " -G wheel -m " $USERNAME "
15
+ # Remove user password, allows sudo use
16
+ passwd -d " $USERNAME "
17
+ exec sudo -u " $USERNAME " " $@ "
18
+ fi
You can’t perform that action at this time.
0 commit comments