本文へスキップ
hdknr blog
戻る

ECS: aws-cli

ECS: aws-cli

ARG BASE_IMAGE=myimage-cicd-appbase
ARG TAG=latest

FROM ${BASE_IMAGE}:${TAG} as server

ARG USERNAME=ubuntu
ARG GROUPNAME=ubuntu
ARG PASSWORD=ubuntu
ARG UID=1000
ARG GID=1000

ENV APP_BASE=/usr/src/app \
    LIB_BASE=/usr/src/lib \
    POETRY_VERSION=1.0.10 \
    PATH="/root/.poetry/bin:$PATH"

RUN mkdir -p /var/run/gunicorn && mkdir -p /storage
RUN apt-get update && apt-get install -y sudo

RUN groupadd -g ${GID} ${GROUPNAME} && \
    useradd -m -s /bin/bash -u ${UID} -g ${GID} -G sudo ${USERNAME} --home-dir ${APP_BASE} && \
    echo ${USERNAME}:${PASSWORD} | chpasswd && \
    echo "${USERNAME}   ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# aws-cli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN sudo ./aws/install

# Application
COPY . ${APP_BASE}
WORKDIR ${APP_BASE}

RUN pip install pip poetry urllib3==1.26.15 -U && \
    poetry config virtualenvs.create false  && \
    poetry install && pip install urllib3==1.26.15 pyOpenSSL -U

RUN chown -R ${USERNAME}:${GROUPNAME} ${APP_BASE}
RUN chmod 777 /run/gunicorn
USER ${USERNAME}

CMD ["/usr/src/app/docker/codebuild/entry_web.sh", "/usr/src/app"]


前の記事
Terraform: Import
次の記事
Windows: クラウド利用