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

Staging環境 #142

Merged
merged 6 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github
.git

node_modules

.DS_Store
/dist
41 changes: 41 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build image (main)

on:
push:
branches:
- main

env:
IMAGE_NAME: traportfolio-ui
H1rono marked this conversation as resolved.
Show resolved Hide resolved
IMAGE_TAG: main

jobs:
image:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: ghcr.io/traptitech/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
deploy-staging:
name: Deploy staging
runs-on: ubuntu-latest
needs: [image]
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.STAGING_SSH_KEY }}
known_hosts: ${{ secrets.STAGING_KNOWN_HOSTS }}
- name: Deploy
run: ssh -t ${{ secrets.STAGING_DEPLOY_USER }}@${{ secrets.STAGING_DEPLOY_HOST }} "sudo sh /srv/portfolio/deploy.sh portfolio-dashboard"
14 changes: 14 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
admin off
}

:80

encode zstd gzip

file_server {
precompressed br gzip
}
root * /usr/share/caddy

try_files {path} /index.html
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM --platform=$BUILDPLATFORM node:16.13.0-alpine as build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんかめっちゃ古いの使ってるからついでにnodeのバージョン上げてもらえると助かります
.node-versionとこの行変えて、一応動作確認すればよさそうかな多分
バージョンはtraPortfolio-UIと同じのでよさそう
めんどくさかったら今回はやらなくてもいいです

WORKDIR /app

RUN apk update \
&& apk --no-cache add openjdk11 \
&& rm -rf /var/cache/apk/*

COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN NODE_ENV=production npm run build

# 本番環境
FROM caddy:2.4.6-alpine
EXPOSE 80
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist /usr/share/caddy