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

Nginxの追加 / GHA #25

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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.