Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaskii committed Oct 17, 2023
1 parent 8dd3930 commit f012a0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.docker
.dockerignore
.git
.gitignore
.github
*.md
docs
Expand Down
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# Stage 1: Build stage
FROM govcmstesting/php:8.1-cli as builder

# Set the working directory to "/tests/"
WORKDIR /tests/
# Set the working directory
WORKDIR /tests

# Copy the project's "composer.json" file into the container
COPY ./composer.json .
# Copy only the necessary files for dependency installation
COPY composer.json composer.lock ./

# Update PHP dependencies using Composer, utilizing a cache for better performance
RUN --mount=type=cache,mode=0777,target=/root/.composer/cache composer update
# Install PHP dependencies using Composer
RUN --mount=type=cache,mode=0777,target=/root/.composer/cache composer install --no-scripts --no-autoloader

# Change the working directory to "/tests/cy"
COPY phpcs.xml .
COPY phpcs.govcms.xml .
# Copy the rest of the application files
COPY . .

# Copy the contents of the local "cy" directory into the container's working directory
COPY ./cy ./cy
# Install Composer dependencies, generate autoloader, and run other build tasks
RUN composer install --no-dev --optimize-autoloader

# Stage 2: Final stage
FROM alpine:3

# Copy the build artifacts from the "builder" stage into the final image
COPY --from=builder /tests /tests
WORKDIR /tests/

COPY --from=builder /tests .

# Set the working directory to "/tests/"
WORKDIR /tests/
# The final image contains the build artifacts

0 comments on commit f012a0d

Please sign in to comment.