Skip to content

Commit

Permalink
Merge pull request #25 from a-company-jp/add-nginx-gha
Browse files Browse the repository at this point in the history
Nginxの追加 / GHA
  • Loading branch information
Shion1305 authored Apr 14, 2024
2 parents 72db139 + 1d27739 commit 747ec1e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-nginx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build&Push Nginx image to GAR
on:
push:
branches:
- main
paths:
- 'docker/nginx/**'
- '.github/workflows/deploy-nginx.yaml'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: 'projects/228944830644/locations/global/workloadIdentityPools/gh-pool/providers/provider-github'
service_account: '[email protected]'

- name: Authorize Docker
id: docker-auth
uses: docker/login-action@v3
with:
username: 'oauth2accesstoken'
password: ${{ steps.auth.outputs.access_token }}
registry: asia-northeast1-docker.pkg.dev

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/nginx:latest
file: ./docker/nginx/Dockerfile
context: ./docker/nginx
6 changes: 6 additions & 0 deletions docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM nginx:1.25.3-alpine

COPY default.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/nginx.conf
COPY www /var/www
CMD ["nginx", "-g", "daemon off;"]
10 changes: 10 additions & 0 deletions docker/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 80;
server_name _;
location /api {
proxy_pass http://localhost:8080;
}
location / {
proxy_pass http://localhost:3000;
}
}
Empty file added docker/nginx/nginx.conf
Empty file.
Empty file added docker/nginx/www/.gitkeep
Empty file.

0 comments on commit 747ec1e

Please sign in to comment.