-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate named image repos for targets
+ better naming + removed obsolete stages
- Loading branch information
1 parent
b64ab38
commit 86993ce
Showing
4 changed files
with
37 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,24 @@ | ||
FROM node:20.12.1-alpine3.19 AS base | ||
|
||
# ENVs | ||
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame | ||
ENV DOCKER_WORKDIR="/app" | ||
## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 | ||
ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" | ||
ENV BUILD_DATE=$BBUILD_DATE | ||
## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 | ||
ARG BBUILD_VERSION="0.0.0-0" | ||
ENV BUILD_VERSION=$BBUILD_VERSION | ||
## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 | ||
ARG BBUILD_COMMIT="0000000" | ||
ENV BUILD_COMMIT=$BBUILD_COMMIT | ||
## SET NODE_ENV | ||
ENV NODE_ENV="production" | ||
## App relevant Envs | ||
ENV PORT="4000" | ||
|
||
# Labels | ||
LABEL org.label-schema.build-date="${BUILD_DATE}" | ||
LABEL org.label-schema.name="ocelot.social:backend" | ||
LABEL org.label-schema.description="Backend of the Social Network Software ocelot.social" | ||
LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" | ||
LABEL org.label-schema.url="https://ocelot.social" | ||
LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" | ||
LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" | ||
LABEL org.label-schema.vendor="ocelot.social Community" | ||
LABEL org.label-schema.version="${BUILD_VERSION}" | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL maintainer="[email protected]" | ||
|
||
RUN apk --no-cache add git python3 make g++ bash | ||
|
||
# Settings | ||
## Expose Container Port | ||
ENV NODE_ENV="production" | ||
ENV PORT="4000" | ||
EXPOSE ${PORT} | ||
|
||
## Workdir | ||
RUN mkdir -p ${DOCKER_WORKDIR} | ||
WORKDIR ${DOCKER_WORKDIR} | ||
RUN apk --no-cache add git python3 make g++ bash | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
CMD ["/bin/bash", "-c", "yarn run start"] | ||
|
||
FROM base AS development | ||
CMD ["/bin/sh", "-c", "yarn install && yarn run dev"] | ||
|
||
FROM base AS code | ||
FROM base AS build | ||
COPY . . | ||
ONBUILD COPY ./branding/constants/ src/config/tmp | ||
ONBUILD RUN tools/replace-constants.sh | ||
|
@@ -57,9 +31,7 @@ ONBUILD RUN cp -r ./public /build/build | |
ONBUILD RUN cp -r ./package.json yarn.lock /build | ||
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive | ||
|
||
FROM code AS build | ||
|
||
FROM code AS test | ||
FROM build AS test | ||
CMD ["/bin/bash", "-c", "yarn run dev"] | ||
|
||
FROM base AS production | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,24 @@ | ||
################################################################################## | ||
# BASE (Is pushed to DockerHub for rebranding) ################################### | ||
################################################################################## | ||
FROM node:20.12.1-alpine3.19 AS base | ||
|
||
# ENVs | ||
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame | ||
ENV DOCKER_WORKDIR="/app" | ||
## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 | ||
ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" | ||
ENV BUILD_DATE=$BBUILD_DATE | ||
## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 | ||
ARG BBUILD_VERSION="0.0.0-0" | ||
ENV BUILD_VERSION=$BBUILD_VERSION | ||
## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 | ||
ARG BBUILD_COMMIT="0000000" | ||
ENV BUILD_COMMIT=$BBUILD_COMMIT | ||
## SET NODE_ENV | ||
ENV NODE_ENV="production" | ||
## App relevant Envs | ||
ENV PORT="3000" | ||
|
||
# Labels | ||
LABEL org.label-schema.build-date="${BUILD_DATE}" | ||
LABEL org.label-schema.name="ocelot.social:webapp" | ||
LABEL org.label-schema.description="Web Frontend of the Social Network Software ocelot.social" | ||
LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" | ||
LABEL org.label-schema.url="https://ocelot.social" | ||
LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/webapp" | ||
LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" | ||
LABEL org.label-schema.vendor="ocelot.social Community" | ||
LABEL org.label-schema.version="${BUILD_VERSION}" | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL maintainer="[email protected]" | ||
|
||
# Install Additional Software | ||
## install: git | ||
RUN apk --no-cache add git python3 make g++ bash jq | ||
|
||
# Settings | ||
## Expose Container Port | ||
ENV NODE_ENV="production" | ||
ENV PORT="3000" | ||
EXPOSE ${PORT} | ||
|
||
## Workdir | ||
RUN mkdir -p ${DOCKER_WORKDIR} | ||
WORKDIR ${DOCKER_WORKDIR} | ||
RUN apk --no-cache add git python3 make g++ bash jq | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
CMD ["/bin/bash", "-c", "yarn run start"] | ||
|
||
FROM base AS development | ||
CMD ["/bin/bash", "-c", "yarn install && yarn run dev"] | ||
|
||
FROM base AS code | ||
FROM base AS build | ||
COPY . . | ||
ONBUILD COPY ./branding . | ||
ONBUILD RUN tools/merge-locales.sh | ||
|
@@ -68,9 +37,7 @@ ONBUILD RUN cp -r ./locales /build | |
ONBUILD RUN cp -r ./package.json ./yarn.lock /build | ||
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive | ||
|
||
FROM code AS build | ||
|
||
FROM code AS test | ||
FROM build AS test | ||
CMD ["/bin/bash", "-c", "yarn run dev"] | ||
|
||
FROM base AS production | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,18 @@ | ||
FROM node:20.12.1-alpine3.19 AS base | ||
ENV DOCKER_WORKDIR="/app" | ||
## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 | ||
ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" | ||
ENV BUILD_DATE=$BBUILD_DATE | ||
## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 | ||
ARG BBUILD_VERSION="0.0.0-0" | ||
ENV BUILD_VERSION=$BBUILD_VERSION | ||
## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 | ||
ARG BBUILD_COMMIT="0000000" | ||
ENV BUILD_COMMIT=$BBUILD_COMMIT | ||
## SET NODE_ENV | ||
ENV NODE_ENV="production" | ||
## App relevant Envs | ||
ENV PORT="3000" | ||
LABEL org.label-schema.build-date="${BUILD_DATE}" | ||
FROM nginx:alpine AS base | ||
LABEL org.label-schema.name="ocelot.social:maintenance" | ||
LABEL org.label-schema.description="Maintenance page of the Social Network Software ocelot.social" | ||
LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" | ||
LABEL org.label-schema.url="https://ocelot.social" | ||
LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/webapp" | ||
LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" | ||
LABEL org.label-schema.vendor="ocelot.social Community" | ||
LABEL org.label-schema.version="${BUILD_VERSION}" | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL maintainer="[email protected]" | ||
RUN apk --no-cache add git python3 make g++ bash jq | ||
EXPOSE ${PORT} | ||
RUN mkdir -p ${DOCKER_WORKDIR} | ||
WORKDIR ${DOCKER_WORKDIR} | ||
|
||
FROM base AS code | ||
FROM node:20.12.1-alpine3.19 AS build | ||
ENV NODE_ENV="production" | ||
RUN apk --no-cache add git python3 make g++ bash jq | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
COPY assets assets | ||
COPY components/LocaleSwitch/ components/LocaleSwitch | ||
COPY components/Dropdown.vue components/Dropdown.vue | ||
|
@@ -51,8 +34,6 @@ ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive | |
ONBUILD RUN cp -r maintenance/source/* ./ | ||
ONBUILD RUN yarn run generate | ||
|
||
FROM code as build | ||
|
||
FROM nginx:alpine AS production | ||
FROM build as production | ||
COPY --from=build ./app/dist/ /usr/share/nginx/html/ | ||
COPY --from=build ./app/maintenance/nginx/custom.conf /etc/nginx/conf.d/default.conf |