-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.66 KB
/
docker-image.yml
File metadata and controls
59 lines (50 loc) · 1.66 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
name: Docker Image CI
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2 # Use v2 instead of v3
- name: Set up environment variables
run: |
echo "WEB_PORT_INTERNAL=3000" >> $GITHUB_ENV
echo "WEB_PORT_EXTERNAL=80" >> $GITHUB_ENV
echo "APP_VOLUME_PATH=./app" >> $GITHUB_ENV
echo "GAME_API_PORT=8080" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: jduncan2022/cosmic-defender:${{ github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker Compose
run: |
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d
env:
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
RAILS_ENV: production
RACK_ENV: production
WEB_PORT_EXTERNAL: 8537
WEB_PORT_INTERNAL: 8537
GAME_API_PORT: https://cosmicdefender.jeremyd.net/
APP_VOLUME_PATH: /volume2/docker/a_test/CosmicDefender