blob: 59274888eeb414bec65f9ba7139886be1cd9ae15 [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
ARG BASE_REGISTRY_URI=us-docker.pkg.dev/chromeos-partner-moblab/base-containers
ARG REGISTRY_URI=gcr.io/chromeos-partner-moblab
ARG LABEL=autopush
######################################################################
FROM ${BASE_REGISTRY_URI}/python:3.8-buster as python3
ARG UID=246
RUN apt-get update && apt-get install --no-install-recommends -yq \
mariadb-client
COPY dockerfiles/moblab_common/requirements.txt ./
# Using legacy resolver https://github.com/pypa/pip/issues/9644
RUN pip3 install --no-cache-dir --use-deprecated=legacy-resolver \
--require-hashes -r requirements.txt
RUN mkdir /workdir
COPY moblab_common/ /workdir/moblab_common/
COPY dockerfiles/moblab_common/moblab_db_migrate.sh /workdir/moblab_common/database_models/
RUN addgroup --gid $UID moblab && adduser --ingroup moblab --uid $UID \
--disabled-password --gecos "" moblab
RUN chown -R moblab:moblab /workdir
RUN chmod uog+rx /workdir/moblab_common/database_models/moblab_db_migrate.sh
USER moblab:moblab
WORKDIR /workdir/moblab_common/database_models
ENV PYTHONPATH='/workdir'
CMD ["/workdir/moblab_common/database_models/moblab_db_migrate.sh"]