-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from lolibrary/dev
Dev env stetup!
- Loading branch information
Showing
9 changed files
with
150 additions
and
2 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
dev |
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 @@ on: | |
branches-ignore: | ||
- 'master' | ||
- 'i18n' | ||
- 'dev' | ||
jobs: | ||
build-push-branch: | ||
container: | ||
|
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,41 @@ | ||
name: Build and push dev image | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'dev' | ||
jobs: | ||
build-push-dev: | ||
container: | ||
image: ghcr.io/lolibrary/builder | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.PAT }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout build tools | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: lolibrary/build | ||
token: ${{ secrets.PAT }} | ||
- name: Checkout Sakura | ||
uses: actions/checkout@v2 | ||
with: | ||
path: cache | ||
- name: GHCR login | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.PAT }} | ||
registry: ghcr.io | ||
- name: Move fontfiles | ||
run: cp fortawesome* cache/ | ||
- name: Docker Build & Push | ||
run: | | ||
docker build -t $DOCKER_SHA_TAG -t $DOCKER_LATEST_TAG --build-arg NOVA_USERNAME=${{ secrets.NOVA_USERNAME }} --build-arg NOVA_API_KEY=${{ secrets.NOVA_API_KEY }} -f cache/dev-dockerfile ./cache/ | ||
docker push $DOCKER_SHA_TAG | ||
docker push $DOCKER_LATEST_TAG | ||
env: | ||
DOCKER_SHA_TAG: "ghcr.io/lolibrary/sakura-dev:${{ github.sha }}" | ||
DOCKER_LATEST_TAG: "ghcr.io/lolibrary/sakura-dev:latest" | ||
|
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 |
---|---|---|
|
@@ -11,3 +11,4 @@ Homestead.yaml | |
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
fortawesome* |
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,16 @@ | ||
FROM php:7.4-alpine | ||
|
||
ARG NOVA_USERNAME | ||
ARG NOVA_API_KEY | ||
|
||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ | ||
RUN apk add --no-cache curl nodejs npm bash \ | ||
&& install-php-extensions intl PDO_PGSQL | ||
|
||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||
|
||
WORKDIR /srv | ||
|
||
COPY . /srv | ||
RUN /srv/dev.sh "SETUP" | ||
ENTRYPOINT [ "/bin/bash", "-c", "/srv/dev.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,24 @@ | ||
#!/bin/bash | ||
cd /srv | ||
|
||
if [[ "$1" == "SETUP" ]]; then | ||
composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_API_KEY" --no-interaction | ||
COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction | ||
|
||
cp fortawesome* ../ | ||
npm install | ||
npm run development | ||
else | ||
npm install | ||
npm run development | ||
|
||
# PHP dev server doesn't have a way of handling a static folder seperately | ||
# so just symlink these where the app expects them. | ||
ln -s /srv/public/assets /srv/assets | ||
ln -s /srv/public/fonts /srv/fonts | ||
ln -s /srv/public/vendor /srv/vendor | ||
ln -s /srv/public/images /srv/images | ||
ln -s /srv/public/categories /srv/categories | ||
php -S 0.0.0.0:3000 /srv/server.php | ||
fi | ||
|
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 @@ | ||
* | ||
!.gitignore |
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,60 @@ | ||
# This will set up the sakura web container and a postgres container it can connect to. | ||
# The dev web container will run `npm install` and `npm run development` on startup, to pick up | ||
# any changes to JS or SCSS files. | ||
|
||
# If you are building the web container from scratch, you will need to provide the email address and | ||
# license key for Nova, and put a Fontawesome tarball in the root directory (or supply a different way | ||
# of accessing it or a replacement in package.json). These two components are propriety and we can't | ||
# redistribute them, sorry! | ||
|
||
# The db container uses mounted storage, so it's not necessary to rerun imports and migrations every time. | ||
# Postgres will look in /dev/initdb the first time the container is started and run any sql or shell scripts in there. | ||
|
||
version: "3" | ||
services: | ||
db: | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: lolibrary | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: library | ||
PGDATA: /var/lib/postgresql/data/pgdata | ||
ports: | ||
- "8001:5432" | ||
volumes: | ||
- ./dev:/var/lib/postgresql/data:rw | ||
- ./dev/initdb:/docker-entrypoint-initdb.d | ||
web: | ||
image: ghcr.io/lolibrary/sakura-dev:latest | ||
# build: | ||
# context: . | ||
# dockerfile: ./dev-dockerfile | ||
# args: | ||
# NOVA_USERNAME: <email address for Nova license> | ||
# NOVA_API_KEY: <key for Nova license> | ||
environment: | ||
- APP_DEBUG=true | ||
- APP_KEY=insecurerandomkey111111111111111 | ||
- DB_CONNECTION=pgsql | ||
- DB_DATABASE=library | ||
- DB_USERNAME=postgres | ||
- DB_PASSWORD=lolibrary | ||
- DB_HOST=db | ||
- AWS_DEFAULT_REGION=nyc3 | ||
- AWS_BUCKET=lolibrary | ||
- AWS_URL="https://lolibrary.nyc3.digitaloceanspaces.com" | ||
- AWS_CDN_URL="https://lolibrary.nyc3.cdn.digitaloceanspaces.com" | ||
- APP_URL="http://0.0.0.0:3000" | ||
- HTTPS_OFF=1 | ||
volumes: | ||
- ./app:/srv/app | ||
- ./database:/srv/database | ||
- ./nova-components:/srv/nova-components | ||
- ./resources:/srv/resources | ||
- ./routes:/srv/routes | ||
- ./tests:/srv/tests | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db |
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