Skip to content

Commit

Permalink
Fix copying code to Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
amCap1712 committed Aug 17, 2023
1 parent 520e279 commit c05282f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PYTHON_BASE_IMAGE_VERSION=3.11-20221221
ARG NODE_VERSION=16-alpine
FROM metabrainz/python:$PYTHON_BASE_IMAGE_VERSION as metabrainz-dev
FROM metabrainz/python:$PYTHON_BASE_IMAGE_VERSION as metabrainz-base

ARG PYTHON_BASE_IMAGE_VERSION

Expand Down Expand Up @@ -33,13 +33,17 @@ RUN apt-get update \
# so that we know what user it is created as: https://github.com/moby/moby/issues/36677
RUN mkdir -p /code/metabrainz /static

WORKDIR /code
WORKDIR /code/metabrainz

COPY requirements.txt /code/
COPY requirements.txt /code/metabrainz
RUN pip3 install pip==21.0.1
RUN pip install --no-cache-dir -r requirements.txt

COPY . /code/
############################################
# NOTE: The development image starts here. #
############################################
FROM metabrainz-base as metabrainz-dev
COPY . /code/metabrainz

#####################################################################################################
# NOTE: The javascript files are continously watched and compiled using this image in developement. #
Expand Down Expand Up @@ -77,7 +81,7 @@ RUN npm run build:prod
###########################################
# NOTE: The production image starts here. #
###########################################
FROM metabrainz-dev as metabrainz-prod
FROM metabrainz-base as metabrainz-prod

RUN pip install --no-cache-dir uWSGI==2.0.22

Expand All @@ -95,9 +99,8 @@ COPY --from=metabrainz-frontend-prod /code/frontend/js/lib /static/js/lib
COPY --from=metabrainz-frontend-prod /code/frontend/dist /static/dist

# Now install our code, which may change frequently
COPY docker /code/metabrainz/
COPY . /code/metabrainz/

WORKDIR /code/metabrainz
# Ensure we use the right files and folders by removing duplicates
RUN rm -rf ./frontend/
RUN rm -f /code/metabrainz/metabrainz/config.py /code/metabrainz/metabrainz/config.pyc
Expand Down
2 changes: 1 addition & 1 deletion docker/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../"
git describe --tags --dirty --always > .git-version

TAG_PART=${1:-latest}
docker build -t metabrainz/metabrainz:$TAG_PART \
docker build --target metabrainz-prod -t metabrainz/metabrainz:$TAG_PART \
--build-arg GIT_COMMIT_SHA=$(git describe --tags --dirty --always) .
docker push metabrainz/metabrainz:$TAG_PART

0 comments on commit c05282f

Please sign in to comment.