Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile and apko config for a local dev-container environment #1123

Merged
merged 5 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resources
.netlify
.hugo_build.lock
.DS_Store
.bash_history

# Editor / IDE config
.idea
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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 \
--repository-append https://packages.wolfi.dev/os \
--keyring-append https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
--package-append wolfi-baselayout \
--arch $(arch) \
/work/$(cfg) academy.local /work/academy.tar
docker load < academy.tar
rm academy.tar

dev-container:
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 apko.local:latest-$(arch)
jamonation marked this conversation as resolved.
Show resolved Hide resolved
jamonation marked this conversation as resolved.
Show resolved Hide resolved
51 changes: 51 additions & 0 deletions apko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
contents:
repositories:
- https://packages.wolfi.dev/os
jamonation marked this conversation as resolved.
Show resolved Hide resolved
packages:
- apk-tools
- bash
- ca-certificates-bundle
- coreutils
- hugo-extended
- nano
- vim
- tmux
- nginx
- 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

8 changes: 8 additions & 0 deletions config/entrypoint.sh
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
Loading