Skip to content

Commit

Permalink
fix: Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
KEINOS committed Jun 16, 2021
1 parent e218b92 commit 337a898
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

// Add the IDs of extensions you wanït installed when the container is created.
// Note that some extensions may not work in Alpine Linux. See https://aka.ms/vscode-remote/linux.
"extensions": ["foxundermoon.shell-format", "esbenp.prettier-vscode"],
"extensions": [
"foxundermoon.shell-format",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand Down
45 changes: 40 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
# QiiCipher のコマンドだけを含めた Alpine イメージです
# =============================================================================
# QiiCipher for Docker
# =============================================================================
# QiiCipher のコマンドだけを含めた Alpine イメージです。
# マルチステージ・ビルドでテストを実行し、成功した場合のみ QiiCipher のコマンドだけを含めた
# シンプルなイメージを作成します。docker-compose.test.yml により Docker Hub からのダウ
# ンロード(`docker pull`)が可能になります。

# -----------------------------------------------------------------------------
# Test Stage
# -----------------------------------------------------------------------------
FROM shellspec/shellspec:latest AS testbuild

# Install miminum requirements for QiiCipher
RUN apk add --no-cache \
openssl \
openssh \
ca-certificates && update-ca-certificates

# Install requirements for testing
RUN apk add --no-cache \
git \
shellcheck \
shfmt

# Copy the hole repo
COPY . /app
WORKDIR /app

# Run tests
RUN \
/app/.github/run-lint.sh \
&& /app/.github/run-test.sh

# -----------------------------------------------------------------------------
# Final Stage
# -----------------------------------------------------------------------------
FROM alpine

RUN apk add --no-cache \
bash \
curl \
openssl \
openssh \
ca-certificates && update-ca-certificates

COPY ./bin /usr/local/sbin
COPY --from=testbuild /app/bin /usr/local/sbin

CMD ["/bin/ls","/bin/local/sbin"]
CMD ["/bin/ls","/usr/local/sbin"]
8 changes: 8 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Test for Docker Cloud Automated Build
sut:
build: .
volumes:
# Mount test file
- ./run-test_docker-cloud.sh:/app/run-test.sh
# Run the mounted test file inside a container from the built image
entrypoint: enc --help

0 comments on commit 337a898

Please sign in to comment.