Skip to content

Commit

Permalink
chore: docker workflow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Jun 29, 2023
1 parent 4c04bd1 commit 572c95f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,30 @@ jobs:
build-linux:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgresql://postgres:password@localhost:5432/3la-test

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Database
run: |
cargo install sqlx-cli --features postgres
sqlx db setup
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
Expand Down Expand Up @@ -46,6 +66,22 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}

- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Migrate database
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/3la-test
run: |
cargo install --version=0.2.0 sqlx-cli --no-default-features --features postgres
sqlx database create
- uses: actions-rs/cargo@v1
with:
command: test

- name: Build and push
uses: docker/build-push-action@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ COPY . /graphcast-3la
WORKDIR /graphcast-3la

RUN sh install-golang.sh
ENV DATABASE_URL=postgres://postgres:postgres@localhost:5432/test_3la
RUN echo "DATABASE_URL=postgres://postgres:postgres@localhost:5432/test_3la" > .env
ENV PATH=$PATH:/usr/local/go/bin

RUN cargo build --release -p graphcast-3la
RUN cargo build --release

FROM alpine:3.17.3 as alpine
RUN set -x \
Expand Down

0 comments on commit 572c95f

Please sign in to comment.