refactor: modify Dockerfile #1329
Workflow file for this run
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
name: ci | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/workflows/ci.yml | |
- package.json | |
- src/** | |
# start: e2e # | |
- e2e/** | |
# end: e2e # | |
# start: docker # | |
- Dockerfile | |
# end: docker # | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/ci.yml | |
- package.json | |
- src/** | |
# start: e2e # | |
- e2e/** | |
# end: e2e # | |
# start: docker # | |
- Dockerfile | |
# end: docker # | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-node | |
- run: pnpm lint | |
- run: npx biome check . && npx prettier --check './**/*.{md,yml}' | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-node | |
- uses: ./.github/actions/setup-db | |
- run: pnpm build | |
# start: docker # | |
build-docker: | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_SITE_URL: http://localhost:3000 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-node | |
- uses: ./.github/actions/setup-db | |
- run: | | |
docker build \ | |
-t app \ | |
-f Dockerfile \ | |
--add-host=host.docker.internal:host-gateway \ | |
--build-arg DATABASE_USER=${{env.DATABASE_USER}} \ | |
--build-arg DATABASE_PASSWORD=${{env.DATABASE_PASSWORD}} \ | |
--build-arg DATABASE_DB=${{env.DATABASE_DB}} \ | |
--build-arg DATABASE_HOST=${{env.DATABASE_HOST}} \ | |
--build-arg DATABASE_PORT=${{env.DATABASE_PORT}} \ | |
--build-arg DATABASE_SCHEMA=${{env.DATABASE_SCHEMA}} \ | |
--build-arg GOOGLE_CLIENT_ID=${{env.GOOGLE_CLIENT_ID}} \ | |
--build-arg GOOGLE_CLIENT_SECRET=${{env.GOOGLE_CLIENT_SECRET}} \ | |
--build-arg NEXT_PUBLIC_SITE_URL=${{env.NEXT_PUBLIC_SITE_URL}} \ | |
--build-arg NEXTAUTH_SECRET=${{env.NEXTAUTH_SECRET}} \ | |
--build-arg TRACE_EXPORTER_URL=${{env.TRACE_EXPORTER_URL}} \ | |
--build-arg STRIPE_PRICE_ID=${{env.STRIPE_PRICE_ID}} \ | |
--build-arg STRIPE_SECRET_KEY=${{env.STRIPE_SECRET_KEY}} \ | |
--build-arg STRIPE_WEBHOOK_SECRET=${{env.STRIPE_WEBHOOK_SECRET}} \ | |
. | |
env: | |
# please set the following environment variables as github secrets | |
DATABASE_USER: local | |
DATABASE_PASSWORD: 1234 | |
DATABASE_DB: database | |
DATABASE_HOST: host.docker.internal | |
DATABASE_PORT: 5432 | |
DATABASE_SCHEMA: public | |
NEXTAUTH_SECRET: TKDdLVjf7cTyTs5oWVpv04senu6fia4RGQbYHRQIR5Q= | |
GOOGLE_CLIENT_ID: dummy | |
GOOGLE_CLIENT_SECRET: dummy | |
# start: otel # | |
TRACE_EXPORTER_URL: "" | |
# end: otel # | |
# start: stripe # | |
STRIPE_PRICE_ID: price_1 | |
STRIPE_SECRET_KEY: pk_test_1 | |
STRIPE_WEBHOOK_SECRET: whsec_1 | |
# end: stripe # | |
- run: docker run -d -p 3000:3000 app | |
- run: | | |
until $(curl --output /dev/null --silent --fail ${{env.NEXT_PUBLIC_SITE_URL}}); do | |
printf '!' | |
sleep 1 | |
done | |
timeout-minutes: 1 | |
# end: docker # | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-node | |
- uses: ./.github/actions/setup-db | |
with: | |
run_db: false | |
- run: pnpm test | |
# start: e2e # | |
e2e-test: | |
runs-on: ubuntu-latest | |
env: | |
NEXTAUTH_SECRET: UfxvOS6HetHOFkL44YTITYgc0DOuOlz5TBp3jkbnZ3w= | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-node | |
- uses: ./.github/actions/setup-db | |
with: | |
run_db: false | |
- run: pnpm exec playwright install chromium | |
- run: pnpm build:test | |
- run: pnpm test:e2e | |
# end: e2e # |