Skip to content
Merged
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
Binary file added .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml


.vscode/
bearer.jwt
dist/
mmcif_pdbx_v50.dic
conversions.csv
# mmcif_pdbx_v50.dic
# conversions.csv
63 changes: 49 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

# Build stage
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

# Set destination for COPY
WORKDIR /app
Expand All @@ -12,32 +12,67 @@ RUN go mod download

# Copy the source code
COPY main.go ./
COPY conversions.csv /app/conversions.csv
COPY mmcif_pdbx_v50.dic /app/mmcif_pdbx_v50.dic
COPY /data/conversions.csv /app/data/conversions.csv
COPY /data/mmcif_pdbx_v50.dic /app/data/mmcif_pdbx_v50.dic
COPY depositions/onedep ./depositions/onedep
COPY docs ./docs
COPY README.md /app/README.md
COPY /data/empiar_deposition.schema.json /app/data/empiar_deposition.schema.json

ARG VERSION=v.0.1.0

# Build GOARCH=amd64
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go generate .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o /app/depositor

# Final stage
FROM alpine:latest
# Stage 2: download pdb_extract
FROM alpine:3.20 AS extractor

# Set environment variables
ENV PORT=8888
ENV ALLOW_ORIGINS=http://localhost:4200
WORKDIR /opt/pdb_extract

# Copy the binary and other necessary files from the builder stage
RUN apk add --no-cache curl tar
RUN VERSION=$(curl -s https://sw-tools.rcsb.org/apps/PDB_EXTRACT/pdb-extract-latest-version.txt) && \
curl -LO https://sw-tools.rcsb.org/apps/PDB_EXTRACT/pdb_extract_prod_py-${VERSION}.tar.gz && \
tar -xzf pdb_extract_prod_py-${VERSION}.tar.gz

# Final stage using slim because maxit is incompatible with alpine
FROM python:3.12-slim AS final

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
bash \
curl \
build-essential \
cmake \
flex \
bison \
&& rm -rf /var/lib/apt/lists/*

# Copy Go app
COPY --from=builder /app/depositor /app/depositor
COPY --from=builder /app/conversions.csv /app/conversions.csv
COPY --from=builder /app/mmcif_pdbx_v50.dic /app/mmcif_pdbx_v50.dic
COPY --from=builder /app/data/conversions.csv /app/data/conversions.csv
COPY --from=builder /app/data/mmcif_pdbx_v50.dic /app/data/mmcif_pdbx_v50.dic
COPY --from=builder /app/README.md /app/README.md
#WILL REMOVE LATER
COPY --from=builder /app/data/empiar_deposition.schema.json /app/data/empiar_deposition.schema.json
# Copy extracted pdb_extract directory
COPY --from=extractor /opt/pdb_extract/pdb_extract_prod_py-* /app/scripts/


# Set up pdb_extract environment
WORKDIR /app/scripts
RUN pip install --upgrade pip && \
pip install -r REQUIREMENTS.txt && \
bash install.sh

EXPOSE 8888
# Run
WORKDIR /app
CMD ["./depositor"]

ENV PORT=8080
ENV ALLOW_ORIGINS=http://localhost:4201
ENV RCSBROOT=/app/scripts/packages/maxit-v11.300-prod-src

EXPOSE 8080

CMD ["./depositor"]
File renamed without changes.
Loading
Loading