-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Makefile and apko config for a local dev-container environment (#…
…1123) Signed-off-by: Jamon Camisso <[email protected]>
- Loading branch information
1 parent
3b08ba5
commit 59e6da6
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ resources | |
.netlify | ||
.hugo_build.lock | ||
.DS_Store | ||
.bash_history | ||
|
||
# Editor / IDE config | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
cfg?=apko.yaml | ||
arch := $(shell uname -m) | ||
|
||
.PHONY: apko-build dev-container | ||
apko-build: | ||
docker run --rm -v $$PWD:/work -it cgr.dev/chainguard/apko:latest build \ | ||
--arch $(arch) \ | ||
/work/$(cfg) academy.local /work/academy.tar | ||
docker load < academy.tar | ||
rm academy.tar | ||
|
||
dev-container: | ||
ifeq ("$(arch)","x86_64") | ||
docker run --rm \ | ||
-v $$PWD/config/entrypoint.sh:/entrypoint.sh \ | ||
-v $$PWD/public:/usr/share/nginx/html \ | ||
-v $$PWD/nginx.conf:/etc/nginx/nginx.conf \ | ||
-v $$PWD:/home/inky/ \ | ||
-p 8080:8080 -p 1313:1313 \ | ||
-it --user root \ | ||
academy.local:latest-amd64 | ||
else | ||
docker run --rm \ | ||
-v $$PWD/config/entrypoint.sh:/entrypoint.sh \ | ||
-v $$PWD/public:/usr/share/nginx/html \ | ||
-v $$PWD/nginx.conf:/etc/nginx/nginx.conf \ | ||
-v $$PWD:/home/inky/ \ | ||
-p 8080:8080 -p 1313:1313 \ | ||
-it --user root \ | ||
academy.local:latest-$arch | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
contents: | ||
repositories: | ||
- https://packages.wolfi.dev/os | ||
keyring: | ||
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub | ||
packages: | ||
- bash | ||
- ca-certificates-bundle | ||
- coreutils | ||
- hugo-extended | ||
- nano | ||
- nginx | ||
- nodejs | ||
- npm | ||
- tmux | ||
- vim | ||
- wolfi-base | ||
|
||
accounts: | ||
groups: | ||
- groupname: inky | ||
gid: 2000 | ||
users: | ||
- username: inky | ||
uid: 2000 | ||
run-as: inky | ||
|
||
work-dir: /home/inky | ||
|
||
paths: | ||
- path: /var/lib/nginx | ||
type: directory | ||
uid: 2000 | ||
gid: 2000 | ||
permissions: 0o755 | ||
recursive: true | ||
- path: /var/lib/nginx/tmp | ||
uid: 2000 | ||
gid: 2000 | ||
type: directory | ||
# Wide permissions required for running with tmpfs. Seems to be related to Docker bug https://github.com/moby/moby/issues/40881 | ||
permissions: 0o777 | ||
recursive: true | ||
- path: /var/run | ||
uid: 2000 | ||
gid: 2000 | ||
type: directory | ||
# Wide permissions required for running with tmpfs. Seems to be related to Docker bug https://github.com/moby/moby/issues/40881 | ||
permissions: 0o777 | ||
recursive: false | ||
|
||
entrypoint: | ||
command: /bin/bash /entrypoint.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
su - inky -s /bin/bash -c '/usr/sbin/nginx -c /etc/nginx/nginx.conf -e /dev/stderr -g "daemon on;" > /dev/null 2>&1' | ||
printf "\nWelcome to the Academy development environment!\n\n" | ||
export PS1="[academy] ❯ " | ||
export GOPATH="/root/.cache/go" | ||
export CGO_ENABLED=0 | ||
bash -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
canonifyURLs = false | ||
baseURL = "http://localhost:8080" |