Skip to content

Commit

Permalink
test superuser change
Browse files Browse the repository at this point in the history
  • Loading branch information
ucfchandra committed Nov 26, 2024
1 parent 44c74f3 commit c3be2d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
21 changes: 5 additions & 16 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Make envfile
uses: SpicyPizza/[email protected]
with:
envkey_ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }}
envkey_DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}
envkey_STATIC_URL: ${{ secrets.STATIC_URL }}
envkey_STATIC_ROOT: ${{ secrets.STATIC_ROOT }}
envkey_DJANGO_SUPERUSER_USERNAME: ${{ secrets.DJANGO_SUPERUSER_USERNAME }}
envkey_DJANGO_SUPERUSER_PASSWORD: ${{ secrets.DJANGO_SUPERUSER_PASSWORD }}
envkey_DJANGO_SUPERUSER_EMAIL: ${{ secrets.DJANGO_SUPERUSER_EMAIL }}
directory: .
file_name: .env
fail_on_empty: false
sort_keys: false

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -65,7 +50,11 @@ jobs:
DJANGO_SUPERUSER_PASSWORD: ${{ secrets.DJANGO_SUPERUSER_PASSWORD }}
DJANGO_SUPERUSER_EMAIL: ${{ secrets.DJANGO_SUPERUSER_EMAIL }}
run: |
podman build -f Containerfile -t announcements-dev .
podman build \
--build-arg DJANGO_SUPERUSER_USERNAME=${{ secrets.DJANGO_SUPERUSER_USERNAME }} \
--build-arg DJANGO_SUPERUSER_PASSWORD=${{ secrets.DJANGO_SUPERUSER_PASSWORD }} \
--build-arg DJANGO_SUPERUSER_EMAIL=${{ secrets.DJANGO_SUPERUSER_EMAIL }} \
-f Containerfile -t announcements-dev .
podman tag announcements-dev:latest 897722699959.dkr.ecr.us-east-1.amazonaws.com/announcements-dev:latest
podman push 897722699959.dkr.ecr.us-east-1.amazonaws.com/announcements-dev
10 changes: 9 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ COPY . /app

WORKDIR /app

ARG DJANGO_SUPERUSER_USERNAME
ARG DJANGO_SUPERUSER_EMAIL
ARG DJANGO_SUPERUSER_PASSWORD

ENV DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
ENV DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
ENV DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}

RUN sh -c 'python manage.py collectstatic --no-input'
RUN sh -c 'python manage.py createsuperuser --noinput --username $DJANGO_SUPERUSER_USERNAME --email $DJANGO_SUPERUSER_EMAIL'
RUN sh -c 'python manage.py createsuperuser --noinput --username $DJANGO_SUPERUSER_USERNAME --email $DJANGO_SUPERUSER_EMAILI || true'
RUN mkdir -pv /var/log/gunicorn/
RUN mkdir -pv /var/run/gunicorn/
RUN mkdir -pv /var/www/announcements/static/
Expand Down
10 changes: 0 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@ cd /app
python manage.py migrate
source .env

if [ "$DJANGO_SUPERUSER_USERNAME" ]
then
python manage.py createsuperuser \
--noinput \
--username $DJANGO_SUPERUSER_USERNAME \
--email $DJANGO_SUPERUSER_EMAIL
fi

$@

exec gunicorn --workers=2 --threads=4 --worker-class=gthread --bind '[::]:80' --worker-tmp-dir /dev/shm wsgi:application

0 comments on commit c3be2d2

Please sign in to comment.