Skip to content

Commit

Permalink
Remove usages of docker in alt-env build environment
Browse files Browse the repository at this point in the history
We don't build or push a docker image in the alt-env since it's just
meant to use the most recently published image.

This change removes installing docker on the build image and starting
dockerd at the start of the build. It also removes some other unused
code.
  • Loading branch information
ScottG489 committed Jul 3, 2023
1 parent 8ff64ac commit 8a6e1b2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
12 changes: 0 additions & 12 deletions infra/alt-env/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ RUN apt-get update && \
lsb-release \
unzip

RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io

RUN curl https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_linux_amd64.zip -o /tmp/terraform.zip && \
unzip -d /usr/local/bin /tmp/terraform.zip && \
rm /tmp/terraform.zip
Expand All @@ -34,8 +24,6 @@ COPY known_hosts /root/.ssh/known_hosts
RUN mkdir /root/.aws
COPY config /root/.aws/config

RUN mkdir /root/.docker

RUN mkdir -p /opt/build
COPY run.sh /opt/build/run.sh
COPY build_functions.sh /opt/build/build_functions.sh
Expand Down
4 changes: 0 additions & 4 deletions infra/alt-env/build/build_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ setup_credentials() {
local ID_RSA_CONTENTS
local MAINKEYPAIR_CONTENTS
local AWS_CREDENTIALS_CONTENTS
local DOCKER_CONFIG_CONTENTS

readonly ID_RSA_CONTENTS=$(echo -n "$1" | jq -r .ID_RSA | base64 --decode)
readonly MAINKEYPAIR_CONTENTS=$(echo -n "$1" | jq -r .MAIN_KEY_PAIR | base64 --decode)
readonly AWS_CREDENTIALS_CONTENTS=$(echo -n "$1" | jq -r .AWS_CREDENTIALS | base64 --decode)
readonly DOCKER_CONFIG_CONTENTS=$(echo -n "$1" | jq -r .DOCKER_CONFIG | base64 --decode)
[[ -n $ID_RSA_CONTENTS ]]
[[ -n $MAINKEYPAIR_CONTENTS ]]
[[ -n $AWS_CREDENTIALS_CONTENTS ]]
[[ -n $DOCKER_CONFIG_CONTENTS ]]

printf -- "$ID_RSA_CONTENTS" >/root/.ssh/id_rsa
printf -- "$MAINKEYPAIR_CONTENTS" >/root/.ssh/mainkeypair.pem
printf -- "$AWS_CREDENTIALS_CONTENTS" >/root/.aws/credentials
printf -- "$DOCKER_CONFIG_CONTENTS" >/root/.docker/config.json

chmod 400 /root/.ssh/id_rsa
chmod 400 /root/.ssh/mainkeypair.pem
Expand Down
8 changes: 0 additions & 8 deletions infra/alt-env/build/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@ set +x
setup_credentials "$1"
set -x

# Start the docker daemon. This is necessary when using the sysbox-runc container runtime rather than mounting docker.sock
dockerd > /var/log/dockerd.log 2>&1 &
sleep 3

declare -r _PROJECT_NAME='conjob'
declare -r _GIT_REPO='git@github.com:ScottG489/conjob.git'
declare -r _TFSTATE_BUCKET_NAME='tfstate-alt-conjob'

#git clone $_GIT_REPO
cp -r $_PROJECT_NAME "$_PROJECT_NAME"_build
cd "$_PROJECT_NAME"_build

# We don't really need to build the application. The latest changes should have been pushed to docker hub and we aren't trying to deploy with local changes
#build_push_application

tf_backend_init $_TFSTATE_BUCKET_NAME "infra/alt-env/tf"

Expand Down

0 comments on commit 8a6e1b2

Please sign in to comment.