Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Use an official Python runtime as the base image
FROM debian:11-slim AS build
ARG registry=942286566325.dkr.ecr.eu-west-1.amazonaws.com
FROM ${registry}/figshare/debian:11 AS build
LABEL org.opencontainers.image.source https://github.com/figshare/user_documentation

# Set the working directory in the container
WORKDIR /app
Expand Down Expand Up @@ -33,10 +34,16 @@ RUN make swagger_install
FROM build as development

# Make the swagger documentation
RUN make build
RUN make swagger_build

# Expose port 8000 for the server
EXPOSE 8000

# Set the default command to run when the container starts
CMD ["make", "server"]

FROM ${registry}/figshare/nginx:1.18 AS deployment

# Copy the built documentation from the build stage
COPY --from=development /app /app
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
DOCKER_EXE:=docker
DOCKER_BUILD_EXTRA_PARAMS:=
DOCKER_BUILD_PARAMS:=--ssh default --build-arg "DEPHASH=${DEPHASH}" ${DOCKER_BUILD_EXTRA_PARAMS}
TESTS_CONTAINER_NAME:=tests.user_documentation
CIMAGE_DEPLOYMENT_TAG:=figshare/user_documentation:deployment
CIMAGE_LATEST_TAG:=figshare/user_documentation:latest
CONFIGS_DIR:=./auto/configs

build:
mkdocs build
.PHONY: build
Expand Down Expand Up @@ -26,12 +34,13 @@ swagger_install:
cd swagger_documentation && make install
.PHONY: swagger_install

container_images:
docker build --target build -t figshare/user_documentation:build .
docker build -t figshare/user_documentation:latest .
.PHONY: container_images
container-images:
${DOCKER_EXE} build ${DOCKER_BUILD_PARAMS} --target build -t figshare/user_documentation:build .
${DOCKER_EXE} build ${DOCKER_BUILD_PARAMS} --target development -t ${CIMAGE_LATEST_TAG} .
${DOCKER_EXE} build ${DOCKER_BUILD_PARAMS} --target deployment -t ${CIMAGE_DEPLOYMENT_TAG} .
.PHONY: container-images

container_build:
docker run --rm -v $(PWD):/app figshare/user_documentation:build make build
docker run --rm -v $(PWD):/app figshare/user_documentation:build make swagger_build
${DOCKER_EXE} run --rm -v $(PWD):/app figshare/user_documentation:build make build
${DOCKER_EXE} run --rm -v $(PWD):/app figshare/user_documentation:build make swagger_build
.PHONY: container_build