-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.35 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Step 1: Log in to Docker Hub
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
# Step 3: Build the Docker image with secrets
- name: Build the Docker image
run: |
docker build . \
--file Dockerfile \
--tag raisehub_fe:latest \
# Step 4: Tag the Docker image with the repository name
- name: Tag the Docker image
run: |
docker tag raisehub_fe:latest ${{ secrets.DOCKER_USERNAME }}/raisehub_frontend:latest
# Step 5: Push the Docker image
- name: Push the Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/raisehub_frontend:latest
# Step 6: Run the Docker container with secrets
- name: Run the Docker container
run: |
docker run -d \
-e AWS_BUCKET_NAME=${{ secrets.AWS_BUCKET_NAME }} \
-e AWS_BUCKET_REGION=${{ secrets.AWS_BUCKET_REGION }} \
-e AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} \
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
-p 3000:3000 \
raisehub_fe:latest