Skip to content

Commit e52438e

Browse files
committed
simplify dockerfiles
1 parent 3a9b0c1 commit e52438e

File tree

3 files changed

+8
-84
lines changed

3 files changed

+8
-84
lines changed

docker/backend.Dockerfile

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
ARG APP_IMAGE=ghcr.io/ocelot-social-community/ocelot-social/backend
21
ARG APP_IMAGE_TAG_BASE=latest-base
32
ARG APP_IMAGE_TAG_CODE=latest-code
4-
ARG APP_IMAGE_BASE=${APP_IMAGE}:${APP_IMAGE_TAG_BASE}
5-
ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE}
6-
FROM $APP_IMAGE_CODE AS build
73

8-
FROM $APP_IMAGE_BASE AS branded
4+
FROM ghcr.io/ocelot-social-community/ocelot-social/backend:${APP_IMAGE_TAG_CODE} AS build
5+
6+
FROM ghcr.io/ocelot-social-community/ocelot-social/backend:${APP_IMAGE_TAG_BASE} AS branded
97
COPY --from=build /build .

docker/maintenance.Dockerfile

+2-35
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,7 @@
1-
ARG APP_IMAGE=ghcr.io/ocelot-social-community/ocelot-social/maintenance
2-
ARG APP_IMAGE_TAG_BASE=latest-base
31
ARG APP_IMAGE_TAG_CODE=latest-code
4-
ARG APP_IMAGE_BASE=${APP_IMAGE}:${APP_IMAGE_TAG_BASE}
5-
ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE}
62

7-
##################################################################################
8-
# CODE (branded) #################################################################
9-
##################################################################################
10-
FROM $APP_IMAGE_CODE AS code
3+
FROM ghcr.io/ocelot-social-community/ocelot-social/maintenance:${APP_IMAGE_TAG_CODE} as build
114

12-
# copy public constants into the Docker image to brand it
13-
COPY ./branding/static/ static/
14-
COPY ./branding/constants/ constants/
15-
RUN /bin/sh -c 'cd constants && for f in *.ts; do mv -- "$f" "${f%.ts}.js"; done'
16-
17-
# locales
18-
COPY ./branding/locales/*.json locales/tmp/
19-
RUN tools/merge-locales.sh
20-
21-
##################################################################################
22-
# BUILD ##########################################################################
23-
##################################################################################
24-
FROM code AS build
25-
26-
# yarn install
27-
## unnicely done in $APP_IMAGE_CODE at the moment, see main repo
28-
# RUN yarn install --production=false --frozen-lockfile --non-interactive
29-
# yarn generate
30-
RUN yarn run generate
31-
32-
##################################################################################
33-
# BRANDED ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ####
34-
##################################################################################
35-
# FROM $APP_IMAGE_BASE AS branded
365
FROM nginx:alpine AS branded
37-
386
COPY --from=build ./app/dist/ /usr/share/nginx/html/
39-
RUN rm /etc/nginx/conf.d/default.conf
40-
COPY --from=code ./app/maintenance/nginx/custom.conf /etc/nginx/conf.d/
7+
COPY --from=build ./app/maintenance/nginx/custom.conf /etc/nginx/conf.d/default.conf

docker/webapp.Dockerfile

+3-44
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,7 @@
1-
ARG APP_IMAGE=ghcr.io/ocelot-social-community/ocelot-social/webapp
21
ARG APP_IMAGE_TAG_BASE=latest-base
32
ARG APP_IMAGE_TAG_CODE=latest-code
4-
ARG APP_IMAGE_BASE=${APP_IMAGE}:${APP_IMAGE_TAG_BASE}
5-
ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE}
63

7-
##################################################################################
8-
# CODE (branded) #################################################################
9-
##################################################################################
10-
FROM $APP_IMAGE_CODE AS code
4+
FROM ghcr.io/ocelot-social-community/ocelot-social/webapp:${APP_IMAGE_TAG_CODE} AS build
115

12-
# locales
13-
RUN tools/merge-locales.sh
14-
15-
##################################################################################
16-
# BUILD ##########################################################################
17-
##################################################################################
18-
FROM code AS build
19-
20-
# yarn install
21-
RUN yarn install --production=false --frozen-lockfile --non-interactive
22-
# yarn build
23-
RUN yarn run build
24-
25-
##################################################################################
26-
# BRANDED (Does contain only "binary"- and static-files to reduce image size) ####
27-
##################################################################################
28-
FROM $APP_IMAGE_BASE AS branded
29-
30-
# TODO - do all copying with one COPY command to have one layer
31-
# Copy "binary"-files from build image
32-
COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt
33-
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
34-
COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js
35-
# Copy static files
36-
# TODO - this seems not be needed anymore for the new rebranding
37-
# TODO - this should be one Folder containign all stuff needed to be copied
38-
COPY --from=build ${DOCKER_WORKDIR}/config/ ./config/
39-
COPY --from=build ${DOCKER_WORKDIR}/constants ./constants
40-
COPY --from=build ${DOCKER_WORKDIR}/static ./static
41-
COPY --from=build ${DOCKER_WORKDIR}/locales ./locales
42-
COPY --from=build ${DOCKER_WORKDIR}/assets/styles/imports ./assets/styles/imports
43-
COPY --from=build ${DOCKER_WORKDIR}/assets/fonts ./assets/fonts
44-
# Copy package.json for script definitions (lock file should not be needed)
45-
COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json
46-
47-
# Run command
48-
CMD /bin/sh -c "yarn run start"
6+
FROM ghcr.io/ocelot-social-community/ocelot-social/webapp:${APP_IMAGE_TAG_BASE} AS branded
7+
COPY --from=build /build .

0 commit comments

Comments
 (0)