Skip to content

Commit

Permalink
Build and publish docker images (#22)
Browse files Browse the repository at this point in the history
* Remove unknown type identifier for PostgreSQL

* Add GH action building and pushing docker

* Add Dockerfile
  • Loading branch information
adzialocha authored Apr 7, 2021
1 parent 8c6a091 commit c970337
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
debug/
36 changes: 36 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build and upload docker image

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
build-and-push:
name: build-and-push

runs-on: ubuntu-16.04

steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Checkout
uses: actions/checkout@v2

- name: Get ref
id: parse_ref
run: |
echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
p2panda/aquadoggo:latest
p2panda/aquadoggo:${{ steps.parse_ref.outputs.tag }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
name: Cargo caching
- name: Cargo caching
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ekidd/rust-musl-builder:latest AS BUILDER

# Add source code with right permissions
ADD --chown=rust:rust . ./

# Build our application
RUN cargo build --release

# Now, we need to build our _real_ Docker container, copying in `aquadoggo`
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=BUILDER \
/home/rust/src/target/x86_64-unknown-linux-musl/release/aquadoggo \
/usr/local/bin/
CMD /usr/local/bin/aquadoggo
4 changes: 2 additions & 2 deletions aquadoggo/migrations/20201229215646_create-entries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ CREATE TABLE IF NOT EXISTS entries (
author VARCHAR(64) NOT NULL,
entry_bytes TEXT NOT NULL,
entry_hash VARCHAR(128) NOT NULL UNIQUE,
log_id UNSIGNED BIGINT NOT NULL,
log_id BIGINT NOT NULL,
payload_bytes TEXT,
payload_hash VARCHAR(128) NOT NULL,
seq_num UNSIGNED BIGINT NOT NULL,
seq_num BIGINT NOT NULL,
PRIMARY KEY (author, log_id, seq_num)
);

0 comments on commit c970337

Please sign in to comment.