Skip to content

Commit

Permalink
chore: use bento golang base image
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Aug 30, 2023
1 parent 0a9836a commit 5c86809
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/api.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
run: |
cp ./etc/example.env .env
source .env
echo "GOHAN_API_BUILDER_BASE_IMAGE=$GOHAN_API_BUILDER_BASE_IMAGE" >> $GITHUB_ENV
echo "GOHAN_API_BASE_IMAGE=$GOHAN_API_BASE_IMAGE" >> $GITHUB_ENV
- name: Load environment variables from .env file
Expand All @@ -40,7 +39,6 @@ jobs:
with:
context: "{{defaultContext}}:src/api"
build-args: |
BUILDER_BASE_IMAGE=${{ env.GOHAN_API_BUILDER_BASE_IMAGE }}
BASE_IMAGE=${{ env.GOHAN_API_BASE_IMAGE }}
registry: ghcr.io
registry-username: ${{ github.actor }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/api.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
# with:
# context: "{{defaultContext}}:src/api"
# build-args: |
# BUILDER_BASE_IMAGE=${{ env.GOHAN_API_BUILDER_BASE_IMAGE }}
# BASE_IMAGE=${{ env.GOHAN_API_BASE_IMAGE }}
# registry: ghcr.io
# registry-username: ${{ github.actor }}
Expand All @@ -45,4 +44,4 @@ jobs:
- name: API Test
run: |
sudo apt-get install -y tabix
make test-api
make test-api
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ services:
build:
context: $PWD/src/api
args:
BUILDER_BASE_IMAGE: ${GOHAN_API_BUILDER_BASE_IMAGE}
BASE_IMAGE: ${GOHAN_API_BASE_IMAGE}
# also passed in as an ENV from within Dockerfile :
GOHAN_API_INTERNAL_PORT: ${GOHAN_API_INTERNAL_PORT}
Expand Down
3 changes: 1 addition & 2 deletions etc/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ GOHAN_GATEWAY_CPUS=2
GOHAN_API_IMAGE=gohan-api
GOHAN_API_VERSION=latest

GOHAN_API_BUILDER_BASE_IMAGE=golang:1.20-bullseye
GOHAN_API_BASE_IMAGE=ghcr.io/bento-platform/bento_base_image:plain-debian-2023.08.16.2000
GOHAN_API_BASE_IMAGE=ghcr.io/bento-platform/bento_base_image:golang-debian-2023.08.30

GOHAN_API_CONTAINER_NAME=gohan-api
GOHAN_API_SERVICE_HOST=0.0.0.0
Expand Down
15 changes: 2 additions & 13 deletions src/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
ARG BUILDER_BASE_IMAGE
ARG BASE_IMAGE

# Stage 1 - builder
FROM $BUILDER_BASE_IMAGE as builder
FROM $BASE_IMAGE

# Maintainer
LABEL maintainer="Brennan Brouillette <[email protected]>"

WORKDIR /build
WORKDIR /app

COPY . .

# Build gohan api
RUN go mod vendor && \
go build -ldflags="-s -w" -o gohan_api


# Stage two - executioner
FROM $BASE_IMAGE

# Debian updates
# - tabix for indexing VCFs
# - other base dependencies provided by the base image
Expand All @@ -27,11 +21,6 @@ RUN apt-get update -y && \
apt-get install -y tabix && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy pre-built executable from builder stage
COPY --from=builder /build/gohan_api .

# Copy static workflow files
COPY workflows/*.wdl /app/workflows/

Expand Down
7 changes: 3 additions & 4 deletions src/api/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG BUILDER_BASE_IMAGE
ARG BASE_IMAGE

# Stage 1 - builder
FROM $BUILDER_BASE_IMAGE as builder
FROM $BASE_IMAGE

LABEL org.opencontainers.image.description="Local development image for Bento Gohan."
LABEL devcontainer.metadata='[{ \
Expand Down Expand Up @@ -37,4 +36,4 @@ COPY entrypoint.bash .
COPY run.dev.bash .

ENTRYPOINT [ "bash", "./entrypoint.bash" ]
CMD [ "bash", "./run.dev.bash" ]
CMD [ "air" ]

0 comments on commit 5c86809

Please sign in to comment.