Skip to content

Commit

Permalink
Add sha to version
Browse files Browse the repository at this point in the history
  • Loading branch information
langdal committed Mar 21, 2022
1 parent 23a4f94 commit d13e281
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/github-actions-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: GITHUB_REF_NAME
build-args:
- GITHUB_REF_NAME
- GITHUB_SHA
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG GITHUB_REF_NAME=develop
ARG GITHUB_SHA=local
# First stage
FROM python:3.9.1 AS builder

Expand All @@ -15,9 +16,11 @@ RUN pip install -r requirements-fixed.txt

FROM python:3.9.1-slim
ARG GITHUB_REF_NAME
ARG GITHUB_SHA
COPY --from=builder /opt/venv /opt/venv
WORKDIR /code
ENV VERSION=${GITHUB_REF_NAME}
ENV SHA=${GITHUB_SHA}

# add non-root user
RUN addgroup --system user && adduser --system --no-create-home --group user
Expand All @@ -28,7 +31,7 @@ USER user

COPY --from=builder /requirements-fixed.txt /code/requirements-freeze.txt
#COPY version.txt /code
RUN echo "${VERSION}" > /code/version.txt
RUN echo "${VERSION}-${SHA}" > /code/version.txt
COPY optimizerapi/ /code/optimizerapi

ENV FLASK_ENV=production
Expand Down

0 comments on commit d13e281

Please sign in to comment.